Matrix

Basics

Mathematically an array or matrix is define by arranging numerical or symbolic elements. The elements are arranged in rows and columns and in a specific order. In its simplest form an array containing only one element is a scalar value. For example:

A=[2]

is a scalar representing a single number 2. Also note that matrices are typically denoted by boldface capital letters.

A vector is an array that contains only one row or column, each containing multiple elements. Note that vectors are two-dimensional arrays with dimensions 1×n or n×1, where n is the number of elements in the vector's row or column. If a vector contains only one row, it is a horizontal (or row) vector. If a vector contains only one column, it is a vertical (or column) vector.

For example:

A=[123]

is a horizontal vector with dimensions 1×3 and elements 1, 2, and 3.

On the other hand,

B=[1 2 3]

represents a vertical vector with three rows and one column and elements equal to 1, 2, and 3.

A matrix is a two-dimensional array that has a fixed number of rows and columns and contains a number at the intersection of each row and column. A matrix, like vectors and scalars, is usually delimited by square brackets. In general a matrix has dimensions of m×n, where m is the number of rows and n is the number of columns. If m=n, the matrix is called a square matrix.

In general, a matrix with dimensions of m×n is defined by using the following notation:

A=[a11a12a1n a21a22a2n  am1am2amn]

where aij is the element in the ith row and jth column.

Algebraic Operations

Addition and Subtraction

If A and B are matrices of the same size, then their sum C=A+B is also a matrix, where each element of that new matrix is the sum of the correspondingly positioned elements. For example, given:

A=[12 34]

and

B=[56 78]

then

C=A+B=[1+52+6 3+74+8]=[68 1012]

The same is true for subtraction, just apply a negative sign to the second matrix being subtracted.

Scalar Multiplication

Scalar multiplication seems different than just plain multiplication. This is true, you can multiply matrices in different ways. Scalar multiplication is the simplest form of matrix multiplication. You take one matrix and multiply it by a single number. Given the scalar S,

S=2

and the matrix A,

A=[12 34]

then their product is given by:

P=SA=[2×12×2 2×32×4]=[24 68]

Matrix Multiplication

Things get more complicated when multiplying two matrices, i.e. matrices both with more than one element in both rows and columns, together. In this case, the number of columns of the leftmost matrix must be equal to the number of rows of the rightmost matrix. If A is a matrix with dimensions m×n and elements aij for i=1,2,,m and j=1,2,,n and B is a matrix with dimensions n×p and elements bij for i=1,2,,n and j=1,2,,p, then the product C=AB is a matrix that has dimensions m×p and elements cij for i=1,2,,m and j=1,2,,p and where

cij=k=1naikbkj

For example, given A

A=[12 34]

and B

B=[56 78]

then their product is given by

C=AB=[1×5+2×71×6+2×8 3×5+4×73×6+4×8]=[1922 4350]

You take the sum of products of the elements in the rows of the first matrix and the columns of the second matrix when determining the element in the product matrix of the first row and first column.

Dot Product

The dot product is one way of multiplying two vectors together. However the result of the dot product is a scalar. This scalar indicates the degree to which the two vectors are similar. Both in terms of magnitude and orientation. The dot product is also known as the scalar product or inner product. The dot product is defined as:

AB=i=1naibi

where ai and bi are the elements of the vectors A and B.

References

Web Links

Note Links