# 2.6: Matrix Operations

A matrix is a special type of array with well-defined algebraic laws for equality, addition, subtraction, and multiplication. Matrices are defined as the set of coefficients of a system of linear algebraic equations or as the coefficients of a linear coordinate transformation. A linear algebraic system of three equations is given by

${3 x + 4 y - 2 z=-2} \\ {8 x - 2 y - 7 z=5} \label{38} \\ {5 x - 3 y + 4 z=3}$

In matrix form, we express this system of equations according to

$\begin{bmatrix} {3} & { 4} & {-2} \\ {8} & {-2} & {-7} \\ {5} & {-3} & { 4} \end{bmatrix} \begin{bmatrix} {x} \\ {y} \\ {z} \end{bmatrix} = \begin{bmatrix} {-2} \\ { 5} \\ { 3} \end{bmatrix} \label{39}$

The rule for multiplication implied here is that the first row of the $$3\times 3$$ matrix multiplies the $$3\times 1$$ unknown column matrix to obtain the first element of the $$3\times 1$$ known column matrix. In terms of compact notation, we express Equation \ref{39} in the form13

$\mathbf{Au} = \mathbf{b} \label{40}$

Here $$\mathbf{ A}$$ represents the $$3\times 3$$ matrix in Equation \ref{39}

$\mathbf{ A}=\begin{bmatrix} {3} & {4} & {-2} \\ {8} & {-2} & {-7} \\ {5} & {-3} & {4} \end{bmatrix} \label{41}$

while $$\mathbf{u}$$ and $$\mathbf{b}$$ represent the two $$3\times 1$$ column matrices according to

$\mathbf{ u}=\begin{bmatrix} {x} \\ {y} \\ {z} \end{bmatrix} , \qquad \mathbf{ b}=\begin{bmatrix} {-2} \\ { 5} \\ { 3} \end{bmatrix} \label{42}$

The $$3\times 1$$ matrices are sometimes called column vectors; however, the word vector should be reserved for a quantity that has magnitude and a direction, such as a force, a velocity, or an acceleration. In this text, we will use the phrase column matrix for a $$n\times 1$$ matrix and row matrix for a $$1\times n$$ matrix. Examples of a $$1\times 4$$ row matrix and a $$4\times 1$$ column matrix are given by

$\mathbf{ b}=\begin{bmatrix} {3} & {1} & {5} & {6} \end{bmatrix} , \qquad \mathbf{ c}=\begin{bmatrix} { 6} \\ {-2} \\ { 0} \\ { 4} \end{bmatrix} \label{43}$

In a matrix, the numbers are ordered in a rectangular grid of rows and columns, and we indicate the size of an array by the number of rows and columns. The following is a $$4\times 4$$ matrix denoted by $$\mathbf{ A}$$:

$\mathbf{ A}=\begin{bmatrix} {3} & { 1} & { 5} & { 6} \\ {4} & {-3} & { 6} & {-2} \\ {8} & { 3} & {-2} & { 0} \\ {1} & { 5} & { 8} & { 4} \end{bmatrix} \label{44}$

Matrices have a well-defined algebra that we will explore in more detail in subsequent chapters. At this point we will introduce only the operations of scalar multiplication, addition and subtraction. Scalar multiplication of a matrix consists of multiplying each element of the matrix by a scalar, thus if $$c$$ is any real number, the scalar multiple of Equation \ref{44} is given by

$c \mathbf{ A}=\begin{bmatrix} {3c} & { 1c} & { 5c} & { 6c} \\ {4c} & {-3c} & { 6c} & {-2c} \\ {8c} & { 3c} & {-2c} & {0} \\ {1c} & { 5c} & { 8c} & { 4c} \end{bmatrix} \label{45}$

Matrices have the same size when they have the same number of rows and columns. For example, the two matrices $$\mathbf{A}$$ and $$\mathbf{B}$$

$\mathbf{ A}=\begin{bmatrix} {a_{11} } & {a_{12} } & {......} & {a_{1n} } \\ {a_{21} } & {a_{22} } & {......} & {a_{2n} } \\ {....} & {....} & {......} & {....} \\ {a_{m1} } & {a_{m2} } & {......} & {a_{mn} } \end{bmatrix} , \qquad \mathbf{ B}=\begin{bmatrix} {b_{11} } & {b_{12} } & {......} & {b_{1n} } \\ {b_{21} } & {b_{22} } & {......} & {b_{2n} } \\ {....} & {....} & {......} & {....} \\ {b_{m1} } & {b_{m2} } & {......} & {b_{mn} } \end{bmatrix} \label{46}$

have the same size and the sum of $$\mathbf{A}$$ and $$\mathbf{B}$$ is created by adding the corresponding elements to obtain

$\mathbf{ A} + \mathbf{ B}=\begin{bmatrix} {a_{11} +b_{11} } & {a_{12} +b_{12} } & {......} & {a_{1n} +b_{1n} } \\ {a_{21} +b_{21} } & {a_{22} +b_{22} } & {......} & {a_{2n} +b_{2n} } \\ {....} & {....} & {......} & {....} \\ {a_{m1} +b_{m1} } & {a_{m2} +b_{m2} } & {......} & {a_{mn} +b_{mn} } \end{bmatrix} \label{47}$

It should be apparent that the sum of two matrices of different size is not defined, and that subtraction is carried out in the obvious manner indicated by

$\mathbf{ A} - \mathbf{ B}=\begin{bmatrix} {a_{11} -b_{11} } & {a_{12} -b_{12} } & {......} & {a_{1n} -b_{1n} } \\ {a_{21} -b_{21} } & {a_{22} -b_{22} } & {......} & {a_{2n} -b_{2n} } \\ {....} & {....} & {......} & {....} \\ {a_{m1} -b_{m1} } & {a_{m2} -b_{m2} } & {......} & {a_{mn} -b_{mn} } \end{bmatrix} \label{48}$

When working with large matrices, addition and subtraction is best carried out using computers and the appropriate software.