No Layman Left Behind: Linear Algebra: What Matrices Actually Are
No Layman Left Behind: Linear Algebra: What Matrices Actually Are
CATEGO RIES
Linear Algebra: What matrices actually are
Computer Science
July 10, 2011 in Algebra, Linear Algebra, Mathem atics
Theory
Algorithms Most high school students in the United States learn about matrices and matrix
multiplication, but they often are not taught why matrix multiplication w orks
General
the w ay it does. Adding matrices is easy: you just add the corresponding
Authors entries. How ever, matrix multiplication does not w ork this w ay, and for
Mathematics someone w ho doesn’t understand the theory behind matrices, this w ay of
Algebra multiplying matrices may seem extremely contrived and strange. To truly
understand matrices, w e view them as representations of part of a bigger
Linear Algebra
picture. Matrices represent functions betw een spaces, called vector spaces,
Analysis and not just any functions either, but linear functions. This is in fact w hy linear
Combinatorics algebra focuses on matrices. The tw o fundamental facts about matrices is that
Probability every matrix represents some linear function, and every linear function is
represented by a matrix. Therefore, there is in fact a one-to-one
correspondence betw een matrices and linear functions. W e’ll show that
multiplying matrices corresponds to composing the functions that they
represent. Along the w ay, w e’ll examine w hat matrices are good for and w hy
linear algebra sprang up in the first place.
Most likely, if you’ve taken algebra in high school, you’ve seen something like
the follow ing:
Your high school algebra teacher probably told you this thing w as a “matrix.”
You then learned how to do things w ith matrices. For example, you can add
tw o matrices, and the operation is fairly intuitive:
You can also subtract matrices, w hich w orks similarly. You can multiply a matrix
by a number:
Then, w hen you w ere taught how to multiply matrices, everything seemed
w rong:
That is, to find the entry in the -th row , -th column of the product, you look at
the -th row of the first matrix, the -th column of the second matrix, you
multiply together their corresponding numbers, and then you add up the
results to get the entry in that position. In the above example, the 1st row ,
2nd column entry is a because the 1st row of the first matrix is , the
2nd column of the second matrix is , and w e have .
Moreover, this implies that matrix multiplication isn’t even commutative! If w e
sw itch the order of multiplication above, w e get
How come matrix multiplication doesn’t w ork like addition and subtraction? And
if multiplication w orks this w ay, how the heck does division w ork? The goal of
this post is to answ er these questions.
converted by W eb2PDFConvert.com
take a look at w hy w e care about matrices in the first place. The most basic
application of matrices is solving systems of linear equations. A linear equation
is one in w hich all the variables appear by themselves w ith no pow ers; they
don’t get multiplied w ith each other or themselves, and no funny functions
either. An example of a system of linear equations is
that if w e multiplied both sides of the equation (on the left) by w e’d get
The applications of matrices reach far beyond this simple problem, but for now
w e’ll use this as our motivation. Let’s get back to understanding w hat matrices
are. To understand matrices, w e have to know w hat vectors are. A vector
space is a set w ith a specific structure, and a vector is simply an element of
the vector space. For now , for technical simplicity, w e’ll stick w ith vector spaces
over the real numbers, also know n as real vector spaces. A real vector space
is basically w hat you think of w hen you think of space. The number line is a 1-
dimensional real vector space, the x-y plane is a 2-dimensional real vector
space, 3-dimensional space is a 3-dimensional real vector space, and so on. If
you learned about vectors in school, then you are probably familiar w ith
thinking about them as arrow s w hich you can add together, multiply by a real
number, and so on, but multiplying vectors together w orks differently. Does
this sound familiar? It should. That’s how matrices w ork, and it’s no
coincidence.
The most important fact about vector spaces is that they alw ays have a basis.
A basis of a vector space is a set of vectors such that any vector in the space
can be w ritten as a linear combination of those basis vectors. If are
your basis vectors, then is a linear combination if are
real numbers. A concrete example is the follow ing: a basis for the x-y plane is
the vectors . Any vector is of the form w hich can be w ritten
as
so w e indeed have a basis! This is not the only possible basis. In fact, the
vectors in our basis don’t even have to be perpendicular! For example, the
vectors form a basis since w e can w rite
For example, the function defined on the real line is not linear,
since w hereas
. Now , w e connect together all the ideas w e’ve talked
about so far: matrices, basis, and linear transformations. The connection is
that matrices are representations of linear transformations, and you can
figure out how to w rite the matrix dow n by seeing how it acts on a basis. To
converted by W eb2PDFConvert.com
understand the first statement, w e need to see w hy the second is true. The
idea is that any vector is a linear combination of basis vectors, so you only
need to know how the linear transformation affects each basis vector. This is
because, since the function is linear, if w e have an arbitrary vector w hich can
be w ritten as a linear combination , then
converted by W eb2PDFConvert.com
compositional inverses! For example, the linear function mapping to
defined by has no inverse, since many vectors get mapped to
the same value (w hat w ould be? ? ?). This corresponds to
the fact that the 1×2 matrix has no multiplicative inverse. So dividing by
a matrix is just multiplication by , if it exists. There are algorithms for
computing inverses of matrices, but w e’ll save that for another post.
S H A R E
T H I S :
R E L A T E D
30 comments
Com m ents feed for this article
May 5, 2012 at 8:44 am W onderful post, thank you. This is almost
David Miles exactly w hat I w as looking for. Now , I
have to try to translate aspects of this
for high school students. I w onder if the complexity of this is part of the reason
that matrices have been removed from the IB DPs new mathematics
curriculum.
Reply
Novem ber 28, 2012 at 1:51 am great post! this helps me alot for
gary understanding my upper division courses
of linear algebra!
Reply
March 21, 2013 at 4:26 pm You have row s and columns confused.
Charles Peezy Row s are horizontal, columns are
vertical.
Reply
March 21, 2013 at 4:58 pm Yes, row s are horizontal, columns are
Alan Guo vertical. W here in the article do I
make a mistake?
Reply
converted by W eb2PDFConvert.com
May 6, 2013 at 11:59 am Amazing article! Thanks!
Metro Man
Reply
July 5, 2013 at 11:55 am I am a little confused, how does the
Addae f(g(w 1)) = f(w 1+w 2)
and for the second column w hy do you
do f(g(w 2)) = f(2w 1)
Reply
July 6, 2013 at 7:20 am Recall that g is defined to be the
Alan Guo function represented by the matrix B,
w hose first column is (1 1) and
second column is (2 0) in the basis w 1 and w 2. The first column tells us
w hat g(w 1) is and the second column tells us w hat g(w 2) is. In particular,
it tells us g(w 1) = 1*w 1 + 1*w 2 and g(w 2) = 2*w 1 + 0*w 2.
Reply
July 6, 2013 at 5:50 pm Thanks, I sort of saw that. But my
Addae real question is w ere do you plug
in w 1 and w 2? Am I missing
something basic? Sorry for the inconvenience. Thanks for answ ering,
and so quickly as w ell.
converted by W eb2PDFConvert.com
and x being a variable is cleared up. By this method I get it so much more,
thank you.
w hen you go into matrix notation i get lost
w 1 = (1,0)
w 2 = (0,1)
g represents
[12]
[10]
So w hen you say g(w 1) are you are calling upon the vector (1,1) or the first
column that is made by the linear combination of 1w 1+1w 2? Is w 1 similar to
the notation of v1 that you used earlier?
If I understand, in algebraic terms that means that g(x) can be expressed as a
linear combination of basis vectors w 1, w 2 w here they are (1,0) and (0,1)
(w here x is a vector)
g(x) = 1w 1+2w 2
so then w hat happens w hen you put in
w 1?
g(w 1) = ?
every x can be w ritten as a*w 1+b*w 2
Took my a w hile to form my questions, this seems very abstract thank you for
helping.
Reply
July 10, 2013 at 8:32 pm Matrix notation only has meaning
Alan Guo w hen you specify a basis. For
example, w hen I w rite a matrix A as
[a b]
[c d]
w hat that really means is I’ve fixed a basis v1,v2 for the domain V and a
basis w 1,w 2 for the codomain W , and the matrix A represents the linear
function f defined by
This uniquely specifies how f behaves on the entire domain V, since every
vector v in V can be w ritten uniquely as x*v1 + y*v2 for some scalars x,y.
So you can think of v as a variable, w hich is really parametrized by the tw o
variables x,y. Then, by linearity,
Note that the column vector (x, y) on the left hand side is w ritten in the
(v1,v2) basis, so it represents the vector x*v1 + y*v2, w hereas the column
vector (ax + by, cx + dy) on the right hand side is w ritten in the (w 1, w 2)
basis, so it represents the vector (ax + by)*w 1 + (cx + dy)*w 2.
In my examples, I conveniently chose the same basis w 1,w 2 for both the
domain and the codomain.
So anyw ay, to answ er your specific question, w hen I say g(w 1), w hat I
mean is, w 1 is a vector w hich, in the basis w 1,w 2, is w ritten as 1*w 1 +
0*w 2, denoted by the column vector (1,0), and g(w 1) means applying g to
the vector (1,0), so multiply the matrix B by (1,0) w hich w ill give you (1,1),
so g(w 1) = 1*w 1 + 1*w 2.
Reply
August 29, 2015 at 11:51 am I had the same question as
Alex Addae (I think). The w ay I w ould
put it: It *seems* w eird that
g(w 1) = w 1 + w 2, because ‘normally’ w hen you define a function g(x),
the RHS involves only the variable x, e.g. g(x) = 2*x. How ever, for
something like g(x) = 2*x + 5*y, one might react as, “W ait, w here does
y come from? How do you get any sort of y from x?” (Is that w hat you
mean, Addae?)
How ever, if I understand you correctly Alan, I think g(w 1) has a bit
different meaning. It’s more like, w hen I apply the function g to the
basis vector w 1, w hat new vector do I get from any linear combination
converted by W eb2PDFConvert.com
of the basis vectors of the vector space…. NOT necessarily from just
w 1. Does that clear it up?
Meaning that the ker(T) = {0}, and that the Im(T) = V, w here V is the domain…
So if a set of vectors doesn’t span its domain, then the kernel spans a
dimension that is sent to 0 by definition. How does this relate to matrix
multiplication?
So if you have a matrix w here the the vectors making it up are linearly
dependent, such as:
[ 1 -1 -1]
[-1 2 3]
[-2 1 0]
All three vectors only span a tw o space, because one can be expressed in
terms of the others. Is there a w ay to argue that a linear transformation isn’t
one to one simply because of the geometry of spanning? How does this relate
to matrix multiplication?
Reply
O ctober 16, 2013 at 8:15 pm Yes, the kernel of the matrix is
Alan Guo intimately related to the geometry of
the vectors making up the matrix. In
particular, any nonzero linear combination of the columns of the matrix
w hich yields zero (a.k.a. a linearly dependence relation) is a member of the
kernel of the matrix. For instance, in your example matrix, if a, b, c are the
column vectors of your matrix, then w e see that a + 2b – c = 0, so the
column vector (1,2,-1) is in your kernel. In fact, multiplying the column
vector (x,y,z) by the matrix exactly gives you the vector x*a + y*b + z*c,
so the kernel is nontrivial if and only if the columns are linearly dependent.
Reply
Septem ber 12, 2014 at 6:52 am Really good and straightforw ard article.
Juxhino
Thank you!
Reply
August 29, 2015 at 9:49 am Hi,
Gideon
Great post. One question: aren’t there
multiple matrix representations for a given linear function? Doesn’t this mean
that it’s a one to many relationship, not one to one?
converted by W eb2PDFConvert.com
August 29, 2015 at 12:42 pm I don’t see either simultaneous
menomnon equations or Gaussian elimination
mentioned?
Reply
Septem ber 1, 2015 at 8:41 am […]
_ HPJ's Personal
Website
[…]
Reply
Septem ber 1, 2015 at 6:22 pm […]
- code123 […]
Reply
Septem ber 7, 2015 at 4:02 am
Les liens de la semaine – Édition
#148 | French Coding […] Q u’est-ce qu’une m atrice? […]
Reply
Septem ber 13, 2015 at 12:29 amThank you for the excellent explanation.
Peter Varga Another w ay to prove this point is
geometric algebra to draw a few arrow s
and the apt student w ould see how the functions and vectors in a space
correspond.
LEAVE A REPLY
Search
Follow
F O L L O W
L A Y M A N
B E H I N D ”
converted by W eb2PDFConvert.com