# Matrix Calculator Online

## What is Matrix algebra?

• Matrix algebra is a means of making calculations upon arrays of numbers (or data).
• Most data sets are matrix-type

### Why use it?

• Matrix algebra makes mathematical expression and computation easier.
• It allows you to get rid of cumbersome notation, concentrate on the concepts involved and understand where your results come from.

## Definitions

1. Matrices – definitions
2. Matrix notation
3. Equal matrices
4. Addition and subtraction of matrices
5. Scalar multiplication of matrices
6. Transpose of a matrix
7. Special matrices
8. Multiplication of two or more matrices
9. Determinant of a square matrix
10. Inverse of a square matrix
11. Solution of a set of linear equations
12. Eigenvalues and eigenvectors

## Matrices – definitions

• A matrixis a set of real or complex numbers (called elements) arranged in rows and columns to form a rectangular array.
• A matrix having m rows and n columns is called an m × n matrix. For example: $\left(\begin{array}{ccc}5& 7& 2\\ 6& 3& 8\end{array}\right)$ is a 2 × 3 matrix.
• A matrix is a rectangular array of numbers or symbolic elements
In many applications, the rows of a matrix will represent individuals cases (people, items, plants, animals,...) and columns will represent attributes or characteristics
The dimension of a matrix is its number of rows and columns, often denoted as r x c (r rows by c columns) Can be represented in full form or abbreviated form: • scalar a scalar is a number (denoted with regular type: 1 or 22).
• Vector A matrix with one column (column vector) or one row (row vector).
• Row vector A row vector consists of a single row. For example: $\left(\begin{array}{ccc}5& 7& 2\\ 6& 3& 8\end{array}\right)$
• Column vector A column matrix consists of a single column. For example: $\left(\begin{array}{c}6\\ 3\\ 8\end{array}\right)$
• Double suffix notation Each element of a matrix has its own address denoted by double suffices, the first indicating the row and the second indicating the column. For example, the elements of 3 × 4 matrix can be written as: ## Matrix Notation

Where there is no ambiguity a matrix can be represented by a single general element in brackets or by a capital letter in bold type. ## Equal matrices

Two matrices are equal if corresponding elements throughout are equal  Where ## Addition and subtraction of matrices

Two matrices are added (or subtracted) by adding (or subtracting) corresponding elements. For example: ## Multiplication of matrices

1. Scalar multiplication
2. Multiplication of two or more matrices

Scalar multiplication

To multiply a matrix by a single number (a scalar), each individual element of the matrix is multiplied by that number. For example; That is: Properties of matrix addition and scalar multiplication Then :-

• $A+BA=ABA+AA$ Commutative law for addition
• $A+\left(B+C\right)=\left(A+B\right)+C$ Associative law for addition
• $\left(cd\right)A=c\left(dA\right)$ Associative law for scalar multiplication
• $1A=A$ Unit element for scalar multiplication
• $c\left(A+B\right)=cA+cB$ Distributive law 1 for scalar multiplication
• $\left(c+d\right)A=cA+dA$ Distributive law 2 for scalar multiplication

Properties of zero matrices Then the additive identity for all m×n matrices the additive inverse of A ## Transpose of a matrix

If a new matrix is formed by interchanging rows and columns the new matrix is called the transpose of the original matrix. For example, if: Thus  If A = AT, then A is symmetric

## Symmetric matrix

A square matrix A is symmetric if  A = AT

Skew-symmetric matrix:

A square matrix A is skew-symmetric if  AT = A ## TYPES OF MATRICES

 NAME DESCRIPTION EXAMPLE Row matrix A matrix with only 1 row $\left(\begin{array}{cccc}3& 2& 1& 4\end{array}\right)$ Column matrix A matrix with only I column $\left(\begin{array}{c}2\\ 3\end{array}\right)$ Identity matrix Diagonal matrix having each diagonal element equal to one (I) $\left|\begin{array}{cc}1& 0\\ 0& 1\end{array}\right|$ Zero matrix A matrix with all zero entries $\left|\begin{array}{cc}0& 0\\ 0& 0\end{array}\right|$ Upper Triangular matrix Square matrix having all the entries zero below the principal diagonal $\left[\begin{array}{ccc}2& 5& 6\\ 0& 4& 6\\ 0& 0& 7\end{array}\right]$ Lower Triangular matrix Square matrix having all the entries zero above the principal diagonal $\left[\begin{array}{ccc}2& 0& 0\\ 5& 4& 0\\ 3& 6& 7\end{array}\right]$

## Special matrices

• Square matrix
• Diagonal matrix
• Unit matrix (identity matrix)
• Null matrix

Square matrix

• A square matrix is of order m × m.
• A square matrix is symmetric if For example: $\left(\begin{array}{ccc}1& 2& 2\\ 2& 8& 9\\ 5& 9& 4\end{array}\right)$
• A square matrix is skew-symmetric if For example $\left(\begin{array}{ccc}0& 2& 5\\ -2& 0& 9\\ -5& -9& 0\end{array}\right)$

Diagonal Matrices.

A diagonal matrix is a square matrix that has values on the diagonal with all off-diagonal entities being zero Identity Matrix (Unit Matrix)

• An identity matrix is a diagonal matrix where the diagonal elements all equal one. $I=\left[\begin{array}{cccc}1& 0& 0& 0\\ 0& 1& 0& 0\\ 0& 0& 1& 0\\ 0& 0& 0& 1\end{array}\right]$
• It is named I and it comes in different sizes. $I2=\left[\begin{array}{cc}1& 0\\ 0& 1\end{array}\right]$ $I3=\left[\begin{array}{ccc}1& 0& 0\\ 0& 1& 0\\ 0& 0& 1\end{array}\right]$

Null Matrix (Zero Matrix)

A square matrix where all elements equal zero

$\left[\begin{array}{cccc}0& 0& 0& 0\\ 0& 0& 0& 0\\ 0& 0& 0& 0\\ 0& 0& 0& 0\end{array}\right]$

Properties of zero matrices ## Matrix Multiplication

$\left[\begin{array}{cc}1& 0\\ 0& 1\end{array}\right]\left[\begin{array}{cc}5& -2\\ 3& 4\end{array}\right]=\left[\begin{array}{cc}5& -2\\ 3& 4\end{array}\right]$
$\left[\begin{array}{cc}5& -2\\ 3& 4\end{array}\right]\left[\begin{array}{cc}1& 0\\ 0& 1\end{array}\right]=\left[\begin{array}{cc}5& -2\\ 3& 4\end{array}\right]$

So, the identity matrix multiplied by any matrix lets the “any” matrix keep its identity!

Mathematically, IA = A and AI = A !!

### The Multiplicative Identity

$AI=A$ Multiply $\left[\begin{array}{cc}-2& 5\\ 4& 0\end{array}\right]\left[\begin{array}{cc}1& 0\\ 0& 1\end{array}\right]$ $A=\left[\begin{array}{cc}-2& 5\\ 4& 0\end{array}\right]$

### Give the multiplicative identity for matrix B.

This identity matrix is I4.

## Matrix Multiplication constraint

• (m × n) × (p × n) = cannot be done
• (1 × n)  × (n × 1) = a scalar (1x1)
• ## Trace of a Matrix

Trace: the sum of the diagonal of a square matrix. ### Matrix Multiplication- an example  ### Show that AB and BA are not equal for the matrices

Solve $AB=\left[\begin{array}{cc}1& 3\\ 2& -1\end{array}\right]\left[\begin{array}{cc}2& -1\\ 0& 2\end{array}\right]=\left[\begin{array}{cc}2& 5\\ 4& -4\end{array}\right]$
$BA=\left[\begin{array}{cc}2& -1\\ 0& 2\end{array}\right]\left[\begin{array}{cc}1& 3\\ 2& -1\end{array}\right]=\left[\begin{array}{cc}0& 7\\ 4& -2\end{array}\right]$ ### An example in which cancellation is not valid

Show that AC=BC C is noninvertible, (i.e., row 1 and row 2 are not independent) Solve $AC=\left[\begin{array}{cc}1& 3\\ 0& 1\end{array}\right]\left[\begin{array}{cc}1& -2\\ -1& 2\end{array}\right]=\left[\begin{array}{cc}-2& 4\\ -1& 2\end{array}\right]$
$BC=\left[\begin{array}{cc}2& 4\\ 2& 3\end{array}\right]\left[\begin{array}{cc}1& -2\\ -1& 2\end{array}\right]=\left[\begin{array}{cc}-2& 4\\ -1& 2\end{array}\right]$

So  AC=BC
But A≠ B

## Matrix Multiplication Properties

• AB does not necessarily equal BA
• (BA may even be an impossible operation)

For example

• A × B = C (2 × 3) × (3 × 2) = (2 × 2)

• B × A = D (3 × 2) × (2 × 3) = (3 × 3)

• Matrix multiplication is Associative • Multiplication and transposition ## A popular matrix  ## Matrix Multiplication Examples ## Matrix Inverse

• Matrix Inverse: Needed to perform the “division” of 2 square matrices
• In scalar terms A/B is the same as A * 1/B
• When we want to divide matrix A by matrix B we simply multiply by A by the inverse of B
• An inverse matrix is defined as A matrix is a rectangular array of different numbers. we can do different operations like addition, multiplication or subtraction. Matrix size is the number of rows and columns of matrix. the matrix with (m rows) and (n columns) is called m × n. the m & n are calles its dimensions. for example if matrix (A) has 4 rows and 3 columns. we said A is 4 × 3 matrix The sum A+B of two m-by-n matrices A and B is calculated entrywise:

(A + B)i,j = Ai,j + Bi,j, where 1 ≤ im and 1 ≤ jn. $\left(\begin{array}{cc}1& 1\\ 1& 1\end{array}\right)+\left(\begin{array}{cc}1& 1\\ 1& 1\end{array}\right)=\left(\begin{array}{cc}2& 2\\ 2& 2\end{array}\right)$

To add two matrices, it is required that the number of rows in the first matrix be equal to the number of rows in the second matrix and the number of columns in the first matrix equals the number of columns in the second matrix.

The product cA of a number c and a matrix A is computed by multiplying every entry of A by c:

(cA)i,j = c · Ai,j. The transpose of an m-by-n matrix A is the n-by-m matrix AT (also denoted Atr or tA) formed by turning rows into columns and vice versa:

(AT)i,j = Aj,i. The condition same as in matrix addition. it is required that the number of rows in the first matrix be equal to the number of rows in the second matrix and the number of columns in the first matrix equals the number of columns in the second matrix.

To multiply two matrices, the number of columns in the first matrix must be equal to the number of rows in the second matrix.