## Matrix Operations

### Scalar, Vector, Matrix

• Scalar: refers to a quantity consisting of a single real number used to measure magnitude (size)
• Vector: is a row or column of scalars. A vector can be plotted from the point of origin to a point defined in n-dimensional space. Vectors possess two independent properties: magnitude and direction. a vector defined in two dimensions of a cartesian plane but it may also be depicted in polar coordinates as angle and length
 0 2
• Matrix: is a collection of vectors laid out in tabular form (in rows and columns). This sample data matrix contains 3 vectors in 2 cartesian dimensions each
 0, 1, 4 2, 3, 6

### Linear Algebra

In these Vector and Matrix Operations all basic rules of arithmetic hold

• Addition, subtraction, multiplication, division with scalar
 0, 1, 4 2, 3, 6
x2 =  0, 2, 8 4, 6, 12
 0, 1, 4 2, 3, 6
+  0, 1, 4 2, 3, 6
=  0, 2, 8 4, 6, 12
• Transpositions replace the colum index of an item with the row index and vice versa
 0, 1, 4 2, 3, 6
T =  0, 2 1, 3 4 6

Vector Products:

• Dot product of 2 vectors returns a (scalar) number that tells us how similar the vectors are. The Dot product equals the length of vector 1 * length of vector 2 * cosine of the angle between the vectors. The closer the two vectors are in terms of their directions, the more positive is the answer. Dot product of a vector of length 1 with itself is +1, while the dot product with a vector pointing in the opposite direction is -1. orthogonal vectors have a dot product of 0. produces a scalar representing the projection of vector 1 onto vector 2. The dot product is 0 if the two vectors are perpendicular (i.e. orthogonal).
• X.Y = Σxi * yi

• Cross product of two vectors is a vector, i.e., it has both magnitude and direction. The cross product of the vectors has a magnitude of the length of vector 1 * length of vector 2 * sine of the angle between the two vectors. The length of the cross product of 2 vectors of length 1 pointing in the same or opposite directions is 0. At 90o the length of the cross product is 1 or -1 depending on the direction (right-hand rule). produces a vector perpendicular to the two intial vectors with a magnitude and direction oriented by the right-hand rule.
•  -1.6 -0.6 -1.6 -1 0 -1
*  -1.6 -1 -0.6 0 -1.6 -1
=  Σ (-1.62 + -.62 + -1.62) Σ (-1.6*-1 + -.6*0 + -1.6*-1) Σ (-1*-1.6 + 0*-.6 + -1*-1.6) Σ (-12 + 02 + -12)
• Matrix Multiplication: Matrix multiplication is not commutative; that is, order matters when multiplying matrices. The result will have the same number of rows as the first matrix and the same number of columns as the second. To fill the individual cells in the result matrix, multiply each row from the first matrix with each column from the second matrix.
 0, 1, 4 2, 3, 6
x  0, 2, 1, 3, 4 6
=  0*0+1*1+4*4, 0*2+1*3+4*6 2*0+3*1+6*4, 2*2+3*3+6*6
=  17, 27 27, 49
while
 0, 2, 1, 3, 4 6
x  0, 1, 4 2, 3, 6
=  0*0+2*2, 0*1+2*3, 0*4+2*6 1*0+3*2, 1*1+3*3, 1*4+3*6 4*0+6*2, 4*1+6*3, 4*4+6*6
=  4, 6, 12 6, 10, 22 12, 22, 52