Showing posts with label matrices. Show all posts
Showing posts with label matrices. Show all posts

Sunday, 19 May 2013

Linear Algebra - 5

Hi,

Now that we have seen a little about matrices, let's now discuss about matrix multiplication. I will not be discussing how matrix multiplication is done. That is essentially a method. However, i will try to express what matrix multiplication essentially is. Please correct me if there are mistakes in my posts.

Matrix Multiplication by a vector

Before we dive into multiplication of matrices with vectors, let's closely examine what truly a matrix is.
Now, a matrix is essentially a bunch of vectors. We can visualize a matrix in two ways. 

a) Matrix as a bunch of row vectors:$${\begin{pmatrix} \vec r_1  \\ \vec r_2 \end{pmatrix}}$$

Here,$$ \vec r_1 = (a_1, a_2, a_3..a_n) $$$$ \vec r_2 = (b_1, b_2, b_3..b_n) $$  

Thus, the matrix is an  2 x n matrix. since it has two rows and n columns. 

b)Matrix as a bunch of column vectors
Now, the same matrix can be expressed in another way:$${\begin{pmatrix} \vec c_1 \vec c_2 .... \vec c_n \end{pmatrix}}$$
where $$c_1 = (a_1, b_1)$$$$c_2 = (a_2, b_2)$$$$c_n = (a_n, b_n)$$

Thus, we have two ways of looking at the same matrix!Now, let's take a look at matrix multiplication. A matrix multiplication with a vector is essentially the dot product of the vector with each of the row vectors of the matrix. Or, it can also be seen as the sum of the scalar products or the column vectors.

Let's take an example. Let's take a 2x2 matrix $$A = {\begin{pmatrix} 1   2  \\ 3   4 \end{pmatrix}}$$ or
$$A = {\begin{pmatrix} \vec r_1  \\ \vec r_2 \end{pmatrix}}$$
where $$ \vec r_1 = (1, 2)$$$$\vec r_2 = (3, 4)$$
Now, let $$\vec x = (x_1, x_2) $$Now, A.X can be written as $${\begin{pmatrix} \vec r_1   dot  \vec x\\ \vec r_2  dot   \vec x \end{pmatrix}}$$The same can also be written as:$$x_1 * \vec c_1 + x_2 * \vec c_2$$ 

where c1 and c2 are column vectors of A, i.e c1 = (1, 3) and c2 = (2, 4).Thus, this is an interesting way in which matrices can be looked at.
 

Wednesday, 8 May 2013

Linear Algebra - 4

Hi,

So, we have covered some stuff about vectors and their linear combinations, let us now take a look at matrices. Matrices are mathematical objects used to represent arrays of numbers in a neat way. They are mostly used to represent a system of linear transformations. Please note that these are brief overview of concepts and not an in-depth analysis containing proofs. As mentioned in Part-1 of these blogs, these are meant as "notes" for the Khan Academy videos. Please watch the videos for detailed explanation of these concepts.

For example, $$ a * \vec x + b * \vec y = \vec c  |  \vec a, \vec b \in R^2$$$$ a * (x_1, x2_) + b * (y_1, y_2) = (c_1, c_2)  |  \vec a, \vec b \in R^2$$

This can be represented using matrices as, and let AB be the product. 
 

$${\begin{pmatrix} x_1 & y_1  \\  x_2 & y_2 \end{pmatrix}*\begin{pmatrix} a \\ b \end{pmatrix}=AB}$$

Now the right hand side of the equation previous to the above can be represented as,$${\begin{pmatrix} c_1 \\  c_2 \end{pmatrix}=AB}$$

Thus, using matrices, we can neatly represent the above linear system of equations.Operations that can be performed on matrices are:
- Addition
- Subtraction
- Scalar Multiplication
- Matrix Multiplication


Null Space of  a Matrix:

Since we have seen briefly what a matrix is, let us define the null space of matrix. We can visualise a matrix as a set of row vectors or as a set of column vectors.

Here, we can visualize the matrix as consisting of vectors(x1, x2) and (y1, y2) or as (x1, y1) and (x2, y2) $${\begin{pmatrix} x_1 & y_1  \\  x_2 & y_2 \end{pmatrix}}$$

Now, the Null-Space of a matrix A is the set of all vectors of the matrix such that
$$A \vec X = \vec 0 $$
If the above condition is true, then vector X belongs to the null-space of matrix A.
 
It is interesting to note that if the column vectors of a matrix are linearly independent, then 0 vector is the only element of the null-space of the matrix. 

Column Space of  a Matrix:

The column space of a matrix is the set of all possible combinations of all the column vectors of the matrix. Hmm, linear combinations of vectors? Ring a bell?
Yes, it is the span. Thus, column space of a matrix is nothing but the span of all the column vectors of A.

Consider a matrix$${A=\begin{pmatrix} x_1 & y_1  \\  x_2 & y_2 \end{pmatrix}}$$
Thus, $$C(A) = span(x, y) $$

Note: if the column vectors of a matrix are linearly independent, then they can be the basis for the column space of A.