Skip to content

Posts tagged ‘transpose’

Maths 101: Back to basics – Matrices

May 21, 2013

Charles

I’m going to cover broad topics in vectors, matrices and the likes, so i’t may appear that i’m skipping specific’s at time. But hopefully I’ll give a good enough understanding and hopefully be able to add specifics in due course. So onto matrices:

A matrix is an object made up of columns and rows – by association an n x m is row by column matrix of n rows and m columns like so (the …n just denotes the list of values):

    M C O L U M N S
N                            ..n
R                            ..n
O                            ..n
W                            ..n
S                             ..n

Another way to look at it is that each column represents a dimension, if we have say a 3 x 3 matrix we can represent an objects orientation, with each row representing an axis:

X0 Y0 Z0
X1 Y1 Z1
X2 Y2 Z2

In this example each row is a vector (direction) with an x, y and z component and by this three dimensional. This vector is also known as a ‘row vector’, similarly if we got the first components of each row we can call that a ‘column vector. Matrices have no know bounds  – theres no limit to them which makes them important in n-dimensional workflows (stuff that i dig).

There are 4 main big functions of matrices – Transpose, multiplication, determinant and inverse. These 4 are the grease that allows powerful manipulation of matrices. We’ll throw mean (average) in there two because its important in data analysis.

Transpose

We’ll start with something relatively simple but that’ll make a difference when we get to multiplication. All that transpose does is swap rows for columns and vice versa. So a matrix that looked like this:

1 2 3
4 5 6

Becomes this:

1 4
2 5
3 6

Doing this in pseudo code we can do something like this:

for i in column:

for j in rows:

collect rows[i][j]

So we’ve  transposed the matrix, why is this important – we’ll to multiply a matrix with another matrix it needs to have the same amount of columns as the other has rows! We’ll discuss square and identity matrices next…

Advertisements