# Vector Transformation & Linear Transformation

Matrices and Matrix Algebra > Linear Transformation & Vector Transformation

## Vector Spaces

A vector space is a collection of vectors which can be added and multiplied by scalars. It is probably one of the most important concepts in matrix algebra.

A “scalar” has magnitude. For example, a speed of 100 mph.
A “vector” has magnitude and direction.* For example, a velocity of 100 mph north. A vector can be represented in three ways:

1. With an arrow on a coordinate graph.
2. Using a variable, with two numbers (x,y) representing the vector moving x spaces in the horizontal direction and y spaces in the vertical direction.
3. With matrix notation, with the top number representing the vector moving in the horizontal direction and the bottom number representing movement in the vertical direction.

Three ways to represent the vector 100 mph East.

## What is a Vector Space?

A vector space is a collection of vectors that has two requirements:

• Any two vectors can be added without leaving the space.
• Any two vectors can be scaled (multiplied) without leaving the space.

## Real Vector Spaces

Vector Spaces are often defined as Rn vector spaces, which are spaces of dimension n where adding or scaling any vector is possible. R stands for “Real” and these spaces include every vector of the same dimension as the space. For example, the R2 vector spaces includes all possible 2-D vectors. For example, the vectors (2,2), (9,0), and (11,5) are all 2-D vectors (ones that can be represented on an x-y axis). The vector space R3 represents three dimensions, R,4 represents four dimensions and so on.

Obviously, it’s practically impossible to deal with Rn vector spaces, because they contain every possible vector of n dimensions, up to infinity. Instead, we use subspaces, which are smaller vector spaces within a Rn vector space.

*A note on the definition of a vector.
The definition “A “vector” has magnitude and direction” isn’t technically correct, but it gives you a better idea of what a vector is rather than the more formal definition of a vector, which is: a vector is an element of a vector space. That definition wouldn’t help much if you didn’t already have some idea about a vector needing magnitude and direction. As J. Nearing of the University of Miami points out: a car can have both magnitude and direction, but does that make it a vector? Obviously the answer is no, hence the need for the additional clarification.

## Vector Transformation

A vector transformation is a specific type of mapping where you associate vectors from one vector space with vectors in another space.

## The Role of Functions in Vector Transformations

Understanding functions is vital to understanding vector transformations. A function is where one input is mapped to exactly one output. Members of a set are mapped (associated) to unique members of another set. The following notation is used to define the process:
f: X→Y, where X is the domain and Y is the codomain. This just means that some function is mapping vectors in X to vectors in Y

Vector transformations can be thought of as a type of function. For example, if you map the members of a vector space Rn to unique members of another vector space Rp, that’s a function. It’s written in function notation as:
f: Rn → Rp

## Vector Transformation Example

Let’s say you had a vector transformation that mapped vectors in an R3 vector space to vectors in an R2 space. The general way to write the notation is:
f: R3 → R2
A specific example could be:
f(x1,x2,x3) = (X1+3x2,4x3)
Note that f(x1,x2,x3) has three vectors and so belongs in R3 and (X1+3x,4x3) has two vectors and so belongs in R2.
In more familiar (at least, for matrix algebra!) notation, this example could also be written as:

Actually working out the vector transformation is the same as working out a function and involves some basic math. For example, let’s say you had the function f: x→ x2 and you wanted to transform (map) the number 2. You would insert it into the right hand part of the equation to get 22=4. Vector transformation works the same way.

For example, performing a vector transformation from f(2,3,4) to (X1+3x2,4x3) we get:
X1 = 2
X2 = 3
X3 = 4,
so:
(2 + 3(3),4(4)) = (2 + 9, 16) = (11,16)

## Linear Transformation

Linear transformation, sometimes called linear mapping, is a special case of a vector transformation.

Definition:
Let V And W be two vector spaces. The function T:V→W is a linear transformation if the following two properties are true for all u,v, ε, V and scalars C:

1. Addition is preserved by T: T(u+v) = T(u)=T(v). In other words, if you add up two vectors u and v it’s the same as taking the transformation of each vector and then adding them.
2. Scalar multiplication is preserved by t: T(cu)=cT(u). In other words, if you multiply a vector u by a scalar C, this is the same as the transformation of u multiplied by scalar c.

## How to Figure out if a Transformation is Linear

Applying rules 1 and 2 above will tell you if your transformation is a linear transformation. Part One, Is Addition Preserved? Works through rule 1 and Part Two, Is Scalar Multiplication Preserved? works through rule 2. Remember: Both rules need to be true for linear transformations.

Sample Question: Is the following transformation a linear transformation?
T(x,y)→ (x-y,x+y,9x)

### Part One: Is Addition Preserved?

Step 1: Give the vectors u and v (from rule 1) some components. I’m going to use a and b here, but the choice is arbitrary:
u = (a1, a2)
v = (b1, b2)

Step 2: Find an expression for the addition part of the left side of the Rule 1 equation (we’re going to do the transformation in the next step):
(u+v) = (a1, a2) + (b1, b2)
Adding these two vectors together, we get:
((a1 + b1), (a2 + b2))
In matrix form, the addition is:

Step 3: Apply the transformation. We’re given the rule T(x,y)→ (x-y,x+y,9x), so transforming our additive vector from Step 2, we get:
T ((a1+ b1), (a2+ b2)) =
((a1 + b1) – (a2 + b2),
(a1 + b1) + (a2 + b2),
9(a1 + b1)).
Simplifying/Distributing using algebra:
(a1 + b1 – a2 – b2,
a1 + b1 + a2 + b2,
9a1 + 9b1).
Set this aside for a moment: we’re going to compare this result to the result from the right hand side of the equation in a later step.

Step 4: Find an expression for the right side of the Rule 1 equation, T(u) + T(v). Using the same a/b variables we used in Steps 1 to 3, we get:
T((a1,a2) + T(b1,b2))

Step 5: Transform the vector u, (a1,a2). We’re given the rule T(x,y)→ (x-y,x+y,9x), so transforming vector u, we get:
(a1 – a2,
a1 + a2,
9a1)

Step 6: Transform the vector v. We’re given the rule T(x,y)→ (x-y,x+y,9x), so transforming vector v, (a1,a2), we get:
(b1 – b2,
b1 + b2,
9b1)

Step 7: Add the two vectors from Steps 5 and 6:
(a1 – a2, a1 + a2, 9a1) + (b1 – b2, b1 + b2, 9b1) =
((a1 – a2 + b1 – b2,
a1 + a2 + b1 – b2,
9a1 + 9b1)

Step 7 addition in matrix form.

Step 8: Compare Step 3 to Step 7. They are the same, so condition 1 (the additive condition) is satisfied.

### Part Two: Is Scalar Multiplication Preserved?

In other words, in this part we want to know if T(cu)=cT(u) is true for T(x,y)→ (x-y,x+y,9x). We’re going to use the same vector from Part 1, which is u = (a1, a2).

Step 1: Work the left side of the equation, T(cu). First, multiply the vector by a scalar, c.
c * (a1, a2) = (c(a1), c(a2))

Step 2: Transform Step 1, using the rule T(x,y)→ (x-y,x+y,9x):
(ca1 – ca2,
ca1 + ca2,
9ca1)
Put this aside for a moment. We’ll be comparing it to the right side in a later step.

Step 3: Transform the vector u using the rule T(x,y)→ (x-y,x+y,9x). We’re working the right side of the rule 2 equation here:
(T(a1, a2)=
a1 – a2
a1 + a2
9a1)

Step 4: Multiply Step 3 by the scalar, c.
(c(a1 – a2)
c(a1 + a2)
c(9a1))
Distributing c using algebra, we get:
(ca1 – ca2,
ca1 + ca2,
9ca1)

Step 5: Compare Steps 2 and 4. they are the same, so the second rule is true. This function is a linear transformation.

## How to Graph Transformations

Once you’ve committed graphs of standard functions to memory, your ability to graph transformations is simplified. The eight basic function types are: sine, cosine, rational, absolute value, square root, cube (polynomial), square (quadratic) and linear; each has their own domain, range, and shape. When you transform one of these graphs, you shift it up, down, to the left, or to the right. Being able to visualize a transformation in your head and sketch it on paper is a valuable tool. Why? Sometimes the only way to solve a problem is to visualize the transformation in your head. While graphing calculators can be a valuable tool in developing your mathematical knowledge, eventually the calculator will only be able to help you so much.

## Graph Transformations: Steps

Example Problem 1: Sketch the graph of x2 shifted two units to the right and then write the equation for that graph.
Step 1: Visualize the graph of x3, which is a cube (polynomial).

Step 2: Visualize the transformation. All you’re doing is shifting the graph two units to the right. Here’s what the transformed graph looks like:

Step 3: Write the equation. For any function, f(x), the graph of f(x-c) is the graph shifted two units to the right and the graph of f(x+c) is the graph shifted two units to the right. The question asks for two units to the right, so the final equation is f(x) = (x – 2)2. Caution: the graph of x2 – 2 moves the graph down two units, not right!

Example problem 2: Sketch the graph of x2 + 2.
Step 1: Visualize the graph of x2, which is one of the eight basic function types.

Step 2: Sketch the graph. For any function, f(x), a graph f(x) + c is the graph shifted up the y-axis and a graph f(x) – c is a graph shifted down the y-axis. Therefore, x2 + 2 is the graph of x2 shifted two units up the y-axis.

That’s it!

Tip: You can also flip graphs on the x-axis by adding a negative coefficient. For example, while x2 is a parabola above the x-axis, -x2 is a mirror image over the x-axis.

## Other types of transformations

------------------------------------------------------------------------------

If you prefer an online interactive environment to learn R and statistics, this free R Tutorial by Datacamp is a great way to get started. If you're are somewhat comfortable with R and are interested in going deeper into Statistics, try this Statistics with R track.