Matrix Algebra
We review here some of the basic definitions and elementary algebraic
operations on matrices.
There are many applications as well as much interesting theory
revolving around these concepts, which we encourage you to explore
after reviewing this tutorial.
A matrix is simply a retangular array of numbers. For example,
A = 
/       \ 

\       / 


is an m×n matrix (m rows, n columns), where the entry in
the i^{th} row and j^{th} column is a_{ij}. We often write A = [a_{ij}].
Some Terminology
For an n ×n square matrix A, the elements
a_{11},a_{22},…,a_{nn} form the main diagonal of the
matrix. A square matrix is called lower triangular if all the entries above the main diagonal are zero,
upper triangular if all the entries below the main diagonal are zero.
The sum
^{n} ∑ _{k = 1} 
a_{kk} of the elements on the main
diagonal of A is called the trace of A. 
The matrix A^{T} = [a_{ji}] formed by interchanging the rows and
columns of A is called the transpose of A. If A^{T} = A,
the matrix A is symmetric.
We can consider a matrix of complex numbers. If C = [c_{ij}] is a matrix of complex numbers
the matrix C* obtained by taking C^{T} and then taking the complex conjugate of each entry
is called the adjoint matrix (or the conjugate transpose) of C.
Example
Let B = 

/   \ 

\   / 
. The trace of B is 6 + 6 = 0. 
The transpose of B is B^{T} = 
/   \ 

\   / 
. 
Addition and Subtraction of Matrices
To add or subtract two matrices of the same size, simply
add or subtract corresponding entries. That is, if B = [b_{ij}] and
C = [c_{ij}],
B + C = [b_{ij} + c_{ij}] and BC = [b_{ij}  c_{ij}] 

Example
For B = 
/   \ 

\   / 
and C = 
/   \ 

\   / 
, 
B + C = 
/   \ 


\   / 
= 
/   \ 


\   / 


BC = 
/   \ 


\   / 
= 
/   \ 


\   / 


The m×n zero matrix, 0, for which every entry is 0, has
the property that for any m×n matrix A,
Scalar Multiplication
To multiply a matrix A by a number c (a ``scalar''), multiply each
entry of A by c. That is,
Example

Using the matrix B = 
/   \ 

\   / 
from the previous example, 
3B = 3 
/   \ 


\   / 
= 
/   \ 


\   / 
. 

Matrix Multiplication
Let X be an m×n matrix and Y be an n×p matrix.
Then the product XY (or X×Y) is the m×p matrix whose
(i,j)^{th} entry is given by

^{n} Σ
k = 1

x_{ik}y_{kj} 

Notes
 The product XY is only defined if the number of columns of X
is the same as the number of rows of Y.
 (X×Y)^{T} = Y^{T}×X^{T}.
 (X×Y)×Z = X×(Y×Z).^{ }
 XY and YX^{ } may not both be defined. If they both
do exist, they are not necessarily equal and might not even be
of the same size.
Example
For the matrices B = 
/   \ 

\   / 
and C = 
/   \ 

\   / 
, 
BC = 
/   \ 

\   / 
/   \ 

\   / 
= 
/   \ 

\   / 
= 
/   \ 

\   / 


while
CB = 
/   \ 

\   / 
/   \ 

\   / 
= 
/   \ 

\   / 
= 
/   \ 

\   / 


The n×n matrix having all main diagonal entries equal to 1 and
all other entries equal to 0 is called the identity matrix
I. For example, the 3×3 identity matrix is
The n ×n identity matrix has the
property that if A is any n ×n matrix,
Inverse of a Matrix
Start with an n ×n matrix X. Suppose the n ×n
matrix Y has the property that
Then Y is called the inverse of X and is denoted X^{1}.
Notes
 Only square matrices X can have inverses. If X is not square,
then for any Y the product XY will not be the same size matrix as the
product YX (if we're lucky enough even to have both products exist!).
 Not every square matrix has an inverse. If an inverse exists,
it is unique.
 If a matrix has an inverse, the matrix is said to be
invertible.
The inverse of a 2 ×2 matrix is simple to calculate:
If A = 
/   \ 



\   / 
, then A^{1} = 
1 adbc


/   \ 



\   / 
. 

Example
The inverse of C = 
/   \ 

\   / 
is 
C^{1} = 
1 (1)(0)(2)(1)


/   \ 



\   / 
= 
1 2


/   \ 



\   / 
= 
/   \ 



\   / 


Note that CC^{1} = 
/   \ 

\   / 
/   \ 

\   / 
= 
/   \ 

\   / 
and C^{1}C = 
/   \ 

\   / 
/   \ 

\   / 
= 
/   \ 

\   / 
Matrix B = 
/   \ 

\   / 
does not have an inverse. 
Determinant of a Matrix
How did we know that B = 
/   \ 

\   / 
does not have an inverse? 
The determinant of A, detA, is a number with the property
that A is invertible if and only if detA ≠ 0.
For a 2 ×2 matrix A = 
/   \ 

\   / 
, detA = ad bc. 
Example
For B = 
/   \ 

\   / 
, detB = (6)(6) (9)(4) = 36+36 = 0, so B is not
invertible. That is, B does not have an inverse. 
For a 3 ×3 (or larger) matrix A, things are a little more
complicated:
 Denote by M_{ij}(A) the determinant of the matrix formed by deleting row i and column j from A.
 Define c_{ij}(A) = (1)^{i+j}M_{ij}(A) to be the (i,j) cofactor of A.
 Then we can compute detA by the Laplace Expansion
along any row or column of A:
 Along row i:

det
 A = a_{i1}c_{i1}(A) + a_{i2}c_{i2}(A) + …+ a_{in}c_{in}(A) 

 Along column j:

det
 A = a_{1j}c_{1j}(A) + a_{2j}C_{2j}(A)+ …+ a_{nj}c_{nj}(A) 

Example
Let A = 
/     \ 

\     / 
. 
Along the first row,
 
(1) [ (0)(6)  (1)(1) ]  (1)[ (1)(6)(1)(2) ] + 3 [ (1)(1)(0)(2) ] 

  
  
Computing detA along the second column instead,
 
(1) [ (1)(6)  (1)(2) ]  ( 0)[ (1)(6)(3)(2) ]  1 [ (1)(1)(3)(1) ] 

  
  
It^{ }can be proven that det(A^{T}) = det(A) and that det(A×B) = det(A)·det(B).
Vedi qui per il calcoli con R.
Some computation techniques are discussed in Solving Systems of Equations.
Key Concepts [index]
Let A = [a_{ij}] and B = [b_{ij}] .

Inverse A^{1} of A:
A^{1} satisties AA^{1} = A^{1}A = I.
then A^{1} = 
1 adbc

/   \ 

\   / 
Determinant detA:
detA = adbc.
In general,
along row i:
detA = a_{i1}c_{i1}(A) + a_{i2}c_{i2}(A) +…+ a_{in}c_{in}(A)
along column j:
detA = a_{1j}c_{1j}(A) + a_{2j}C_{2j}(A)+ …+ a_{nj}c_{nj}(A)

