# Linear Algebra for Computer Graphics

Both 2D and 3D computer graphics can be represented using the same concepts on which linear algebra is established - the vector and the matrix (which are really just different manifiestations of the same phenomenon: ordered tuples of measurement). In both the
2nd and 3rd dimension, there is a natural, concrete geometrical representation of the concepts related to vectors. However, if we treat a vector's representation symbolically, using algebraic definitions, statements and equations, we can manupulate them
using a computer quite easily and powerfully.

## Computer Graphics as a Linear System

### Vectors and Euclidian Space

Think of space. You're everyday experiences give you a good understanding of 2- and 3-dimensional space. Things that are in space are at a particular location, and these locations have a particular relationship among them. First, the space in between two
objects can be measured. Second, you can say that one object is located at a particular angle away from the other relative to some third object, or some fixed position in space.

If we had a 2D space (like a piece of paper or a flat plot of land) and a lot of objects in it, we could choose one point and measure all objects from this one point. This would give us a useful system to compare objects - where and how far away they are. We
can call this point the **origin** and then measure away from the origin to find out how far away objects are. In order to know what direction they are in, however, it is useful to define direction in a similar manner as the origin. If we consider the origin
as zero, since it has no distance between it and itself, then let's make a "zero" for direction as well. If we draw a straight line through the origin, and call this line's direction "zero", then any point that lies along it could
be considered to be at a direction of "zero" from the origin. For points not on this line, we can go along the line until we get to a point where the point not on it is a straight line from our "zero" line. The point along our line which
makes the shortest line to get to the point not on the "zero" line gives us another important direction. So now we have two directions, along our "zero" line and away from our "zero" line. If we move the "away from"
direction to the origin, we can now measure along the "zero" line, and along the "away from zero" line and hit any point in our space. This is in fact what one of the best-known coordinate systems - the Cartesian coordinate system -does.
The "zero" line is called the **X axis**, and the "away from zero" line is called the
**Y axis**. We can address any point in 2D space as a pairing of a measurement along the X axis and a measurement along the Y axis. This same idea can be extended to 3D space if you imaging a line coming out of the origin and extending back through it.

Now back to our objects in our 2D space. If we draw a straight line out to an object of interest, we can describe this line as a measure along the X axis and a measure along the Y axis. If you make measurements of these pairings, or tuples, of X values and
Y values, we have a consistent, consice method of describing locations of objects in our system. This tuple of values is known as a
**vector**.

## Linear and Affine Transformations

## Color as a Vector Space