Matrices, vectors and points

Writing a matrix

Create a matrix by typing mat. Insert columns by pressing , and rows by pressing enter. You can navigate between cells using your arrow keys.

Recording of the calculator performing the steps described above

Vectors and points

Vectors and points are just special cases of matrices. A vector is just a matrix with only one row or column. That means a vector with 3 components could be written in either of these ways:

"v" equals Start 1 by 3 matrix, Row 1: 1, 2, 3, End matrix
"v" equals Start 3 by 1 matrix, Row 1: 1; Row 2: 2; Row 3: 3, End matrix

Note that even though these are both considered 3-vectors, you cannot add them together since they have a different shape. They will also behave differently with matrix multiplication.

A point is just a vector with two components. Points are special because they are drawn in the graph. You can adjust the size and color of a point in the same way as a normal graph: right click or long left click the color swatch next to the point, and then adjust the options in the menu. You can also click this color swatch to toggle the point on and off in the graph.

Recording of the calculator performing the steps described above

You can also make a point draggable by checking the draggable box in the menu as long as the point is not dependent on any other variables, and does not include math expresions.

Accessing elements of a vector

You can pull a single component out of a vector by writing v[n], where n is the position of the component you want. Positions are counted from zero, so v[0] is the first component, v[1] is the second, and so on.

"v" equals Start 3 by 1 matrix, Row 1: 10; Row 2: 20; Row 3: 30, End matrix
"v" left bracket, 0 , right bracketequals 10
"v" left bracket, 2 , right bracketequals 30

The first four components also have names. You can write v.x, v.y, v.z and v.w to access components 0 through 3. For points and small vectors this usually reads more naturally than a numbered index.

"p" equals Start 2 by 1 matrix, Row 1: 3; Row 2: 4, End matrix
"p" . "x"equals 3
"p" . "y"equals 4

Both forms work the same way on row vectors and column vectors, and the result is an ordinary value that you can use anywhere else in your math:

"p" equals Start 2 by 1 matrix, Row 1: 3; Row 2: 4, End matrix
StartRoot, "p" . "x" squared plus "p" . "y" squared , EndRootequals 5

The index has to be a number written directly into the expression. Indexing with a variable (for example v[k]) is not currently supported. Out-of-range indices show an error immediately: asking for v[3] on a 3-component vector is caught right away.

Single-index access works on vectors with up to 4 components. For a longer vector, use the slice form from the next section instead: on a column vector, v[:, n] reads component n.

Accessing elements of a matrix

The easiest way to think about indexing a matrix is to think of the matrix as a row of column vectors standing side by side. Writing M[i] picks out the ith column, counted from zero:

"M" equals Start 2 by 3 matrix, Row 1: 1, 2, 3; Row 2: 4, 5, 6, End matrix
"M" left bracket, 1 , right bracketequals Start 2 by 1 matrix, Row 1: 2; Row 2: 5, End matrix

Since M[i] is a vector, you can index it again to get a single element. M[i][j] picks column i and then reads component j from it, exactly like indexing a vector. The two-index form M[i, j] is a shorthand for the same thing. In other words, the first index says how far across to go and the second says how far down, the same order as ( "x" , "y" ) coordinates on the graph.

"M" equals Start 2 by 3 matrix, Row 1: 1, 2, 3; Row 2: 4, 5, 6, End matrix
"M" left bracket, 2 , 0 , right bracketequals 3
"M" left bracket, 0 , 1 , right bracketequals 4
"M" left bracket, 0 , right bracket left bracket, 1 , right bracketequals 4

Heads up if you're coming from textbooks or other tools: the written convention "A" Subscript, "j" "k" , Baseline and most programming languages put the row index first. Eigenslate puts the column first, so M[i, j] is column i, row j. If a lookup ever surprises you, remember: across, then down.

Extracting rows and columns

You can use : in place of an index to mean "all of them". M[:, j] keeps every column and fixes the row, giving you row j as a row vector. M[i, :] fixes the column and keeps every row, which is just a longer way of writing M[i].

"M" equals Start 2 by 3 matrix, Row 1: 1, 2, 3; Row 2: 4, 5, 6, End matrix
"M" left bracket, : , 1 , right bracketequals Start 1 by 3 matrix, Row 1: 4, 5, 6, End matrix
"M" left bracket, 1 , : , right bracketequals Start 2 by 1 matrix, Row 1: 2; Row 2: 5, End matrix

A row or column extracted this way is a real vector, so everything from the previous section applies to it. For example M[1, :].x reads the top entry of column 1.

Quick reference

You writeYou get
v[n]component n of a vector (up to 4 components)
v.x v.y v.z v.wcomponents 0, 1, 2, 3
M[i]column i
M[i, j] or M[i][j]the element in column i, row j
M[:, j]row j
M[i, :]column i (same as M[i])

Matrix operations

Matrix multiplication and addition

You can add and multiply matricies using standard rules of matrix multiplication.

Start 2 by 2 matrix, Row 1: 1, 0; Row 2: 0, 1, End matrix plus Start 2 by 2 matrix, Row 1: 0, 2; Row 2: 3, 1, End matrixequals Start 2 by 2 matrix, Row 1: 1, 2; Row 2: 3, 2, End matrix
Start 2 by 2 matrix, Row 1: 0, negative 1; Row 2: 1, 0, End matrix Start 2 by 1 matrix, Row 1: 1; Row 2: 2, End matrixequals Start 2 by 1 matrix, Row 1: negative 2; Row 2: 1, End matrix

Transpose

The transpose of a matrix can be written as M^H or matrix^\top followed by a space to complete the \top. Note that this is the hermitian transpose meaning the complex conjugate is applied to all entries. You can ignore this if you aren't working with complex matricies.

Recording of the calculator performing the steps described above

Determinant

The determinant of a matrix is written det(M).

det left parenthesis, Start 2 by 2 matrix, Row 1: 1, 2; Row 2: 3, 4, End matrix , right parenthesisequals negative 2

Inverse

The inverse of a matrix is written matrix^(-1).

Start 2 by 2 matrix, Row 1: 1, 2; Row 2: 3, 4, End matrix to the negative 1st powerequals Start 2 by 2 matrix, Row 1: negative 2, 1; Row 2: 1.5, negative 0.5, End matrix

You can divide by a matrix and it is the same as multiplying by the inverse of that matrix on the left.

Start 2 by 2 matrix, Row 1: 1, 2; Row 2: 3, 4, End matrix to the negative 1st power Start 2 by 1 matrix, Row 1: 2; Row 2: 1, End matrixequals Start 2 by 1 matrix, Row 1: negative 3; Row 2: 2.5, End matrix
StartFraction, Start 2 by 1 matrix, Row 1: 2; Row 2: 1, End matrix Over Start 2 by 2 matrix, Row 1: 1, 2; Row 2: 3, 4, End matrix , EndFractionequals Start 2 by 1 matrix, Row 1: negative 3; Row 2: 2.5, End matrix

Matrix exponential

The matrix exponential is computed by raising e to the power of a square matrix.

"e" Superscript, Start 2 by 2 matrix, Row 1: 0, 1; Row 2: 0, 0, End matrix , Baselineequals Start 2 by 2 matrix, Row 1: 1, 1; Row 2: 0, 1, End matrix

Note that this is not the same as raising e to each entry of the matrix (that would have turned the zeros into ones). The matrix exponential is the matrix version of the exponential function: the derivative of "e" Superscript, "A" "t" , Baseline with respect to "t" is "A" "e" Superscript, "A" "t" , Baseline, just like the ordinary exponential. That property makes it the natural way to write solutions of linear differential equations: if StartFraction, "d" "x" Over "d" "t" , EndFraction equals "A" "x", then "x" ( "t" ) equals "e" Superscript, "A" "t" , Baseline "x" ( 0 ).

One consequence you can check directly: rotations are matrix exponentials. Raising e to Start 2 by 2 matrix, Row 1: 0, negative theta ; Row 2: theta , 0, End matrix rotates by the angle theta, and with theta equals StartFraction, pi Over 2 , EndFraction the result is exactly the rotation matrix from the multiplication example above.

"e" Superscript, Start 2 by 2 matrix, Row 1: 0, negative StartFraction, pi Over 2 , EndFraction ; Row 2: StartFraction, pi Over 2 , EndFraction , 0, End matrix , Baselineequals Start 2 by 2 matrix, Row 1: 0, negative 1; Row 2: 1, 0, End matrix