Pulsars
0 %
Log inSign up

The matrix product and its uses

The identity matrix and a geometric application

The identity matrix

The identity matrix I (of size n x n) is a square matrix that contains 1s on the main diagonal (from top-left to bottom-right) and 0s everywhere else. For the matrix product it plays the same role as the number 1 for ordinary multiplication: for any compatible matrix A, A x I = A and I x A = A.

Identity matrix of size 2 x 2:

      [ 1  0 ]
I2 =  [ 0  1 ]

Check with A = [[1,2],[3,4]]:

A x I2 = [ 1*1+2*0   1*0+2*1 ]  =  [ 1  2 ]  = A
         [ 3*1+4*0   3*0+4*1 ]     [ 3  4 ]

(multiplying by the identity changes nothing in the matrix)

Application: transforming a point

A point of the plane with coordinates (x, y) can be represented by a column matrix. Applying a linear transformation (rotation, scaling) amounts to multiplying this column matrix by a transformation matrix M.

Scaling transformation M = [[2,0],[0,3]] applied to the point P = (1, 1):

        [ 2  0 ]   [ 1 ]     [ 2*1 + 0*1 ]     [ 2 ]
M x P = [ 0  3 ] x [ 1 ]  =  [ 0*1 + 3*1 ]  =   [ 3 ]

(the point (1,1) becomes the point (2,3): x is doubled, y is tripled)

You can also rotate a point by 90 degrees with the matrix R = [[0,-1],[1,0]]. Applied to the point (1, 0), you get R x (1,0) = (0, 1): the point has indeed turned a quarter of a turn.

Common pitfall

In a transformation M x P, the order matters: P must be a column matrix placed to the right of M so that the sizes are compatible (M is n x n, P is n x 1, the result is n x 1). Writing P x M would amount to attempting a product that is often impossible, or to a completely different result.