If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

### Course: Linear algebra>Unit 2

Lesson 2: Linear transformation examples

# Linear transformation examples: Rotations in R2

Linear Transformation Examples: Rotations in R2. Created by Sal Khan.

## Want to join the conversation?

• I'm a bit confused. The unit circle definition of trig functions shows that the Y-coordinate is acquired with sin, and the X-coordinate acquired with cosin. Why on the second vector was the X-coordinate set to -sin? Couldn't just cosin be used here to get the X-coordinate?
• On the unit circle, you start from the point (1,0) and move counter-clockwise. That's exactly what he's doing around when he rotates e1. However, when he's rotating e2 at , he's starting from the point(0,1) and going counter-clockwise, making it different from the unit circle.
• Why is A ( the transformation matrix) simply the columns of the transformation of the unit vectors?
• Given `A x⃑ = b⃑` where `A = [[1 0 0] [0 1 0] [0 0 1]]` (the ℝ³ identity matrix) and `x⃑ = [a b c]`, then you can picture the identity matrix as the basis vectors î, ĵ, and k̂. When you multiply out the matrix, you get `b⃑ = aî+bĵ+ck̂`. So [a b c] can be thought of as just a scalar multiple of î plus a scalar multiple of ĵ plus a scalar multiple of k̂. So anytime we want a transformation to do something to any point [a b c], we just need to rotate and scale the basis vectors. The point that's a scalar multiple of them will also follow the same transformation. So when you transform the identity matrix into your transformation matrix, what you're really doing is changing the basis vectors to match your intended effect. I hope that was clear enough to make sense.
• When I have an image in paint and I rotate it 90 degrees, is some type of code like this running? Or are there are other ways to do this? (On a windows computer, by the way).
• Since 90° is a special angle, it's very likely that the computer algorithm to rotate 90° uses some kind of shortcut to minimise computations.

For a generic angle of rotation, the computer most likely is applying a transformation very much like this one to each pixel in the image.
• I am still confused how when finding x you subtract the y axis sine from the x axis cosine and vise versa. Please help me understand this.
• Sometimes it helps to review the basics. Try this:

1) If we can get a transformation matrix that works for both i = (1, 0) and j = (0, 1), that matrix will work for any vector. Why? I don't know, but he's been telling us this for quite a while.

2) Sketch i and its rotation u by angle t, and then j on a separate xy plane with its rotation v by the same angle t.

3) Find the coordinates of u (u1 and u2) and v (v1 and v2) from trig (the hypotenuse or the length of both u and v is 1. Try to answer this by yourself. i and j are rotated by the same angle, but the angles are in different quadrants, and the angle of v is 90 plus t, but (and this gets to your question) v1 and v2 need to be expressed in terms of t, just like u1 and u2, not 90+t.

4) (u1, u2) = (cost, sint) and (v1, v2) = (-sint, cost).

5) If you make a 2x2 matrix A whose column vectors are u = (cost, sint) and v = (-sint, cost), then A*i = 1*u + 0*v = u, and A*j = 0*u + 1*v = v, which is the transformation we're looking for.
• When Sal talks about rotating the square, doesn't he actually mean rotating the vectors defined by the DIFFERENCE between the vectors defining the square's corners, and not those vectors themselves? I believe this is how he defined the triangle he transformed several videos ago.
• By considering the difference between the vectors, Sal was trying to show how linear transformations affected a given set, namely the line formed by the difference between two vectors. However, conclusion was that the only part that really mattered after the transformation was where the endpoints of the three position vectors that formed the triangle ended up. While both points of view are valid, working with the vectors themselves is considerably more simple to think about.
• I suppose it isn't a coincidence that the determinant of the matrix Sal created is 1:
cos(theta) x cos(theta) - (sin(theta) x -sin(theta)) =
cos^2(theta) + sin^2(theta) = 1.

Is there a reason for this?
• There is indeed a reason for that. For a transformation, the determinant is the amount by which the area of some transformed object is changed. If we had a determinant of 2, this means we double the area. If we have a determinant of 1, as in this example, then the area stays exactly the same.

(As a side note, if you have a negative determinant, you inverse the handedness of your vectors. A right-handed system has the x axis clockwise from the y axis. If you find that your x-unit vector gets transformed to be counter clockwise of the (transformed) y unit vector, then you have swapped the handedness, and thus get a negative determinant.)
• Is there a relation between what Sal has done in this video and "Integration" and "Differentiation"
• It's an interesting connection to make. But if there is a connection between the two notions, I can't figure out what it would be.

Here's the connection I make. If we imagine that x in the unit vector rotated by an angle of φ, its coordinates will be (cos φ, sin φ) like Sal was showing in this video. Now if we apply the transformation of a rotation by angle θ, the resultant vector would be (cos (φ+θ), sin (φ+θ)) which is the same as (cosφ cosθ - sinφ sinθ, sinφ cosθ + cosφ sinθ). So what 2x2 matrix A satisfies A(cos φ, sin φ) = (cosφ cosθ - sinφ sinθ, sinφ cosθ + cosφ sinθ)? Well, it would have to be exactly the matrix A that Sal came up with in this video. So, to me, the formula is really strongly connected to the sum formulas for sine and cosine. Hope that helps you to get an intuitive feel for it (and maybe help you memorize the matrix as long as you've already memorized the sum formulas). ^_^
• Can someone provide the worked out multiplication of:
Rot45° (→x)= [√2/2, √2/2, √2/2, √2/2, ] →x
This is the last equation Sal wrote starting at . I am new to this material and I am still confused by the notation involved in dot product as opposed to regular multiplication/distribution. For example, Sal wrote the formula starting at as:
[cos⩉, sin⩉, -sin⩉, cos⩉] is multiplied by "[x1, x2]"
rather than multiplied by "→x" as in the final example I referenced at the beginning of this post and I'm not quite clear on how those are interchangeable or when a • stands for dot product and when it means multiply. Thanks!
• So a very neat thing about matrix multiplication is that it actually is just the dot product of the rows and columns of the matrices you are multiplying together. Maybe this will be able to explain it better:
http://mathinsight.org/matrix_vector_multiplication
Also [x1, x2] are just the vector components of the vector x.
For the Rotation example, let's say you have a square with vertices at the points [(0, 0), (0, 1), (1, 1), (1, 0)] then to find you new rotated square (by an angle of 45 degrees) multiply the transformation matrix with each of these points. The new postions will be [(0, 0), (-sqrt(2)/2, sqrt(2)/2), (0, 2*sqrt(2)), (sqrt(2)/2, sqrt(2)/2)]. If you draw that you'll see that the method worked!
Hope this helped you. :-)
• I understand the rotation of (1,0) and (0,1). But is there a good geometric visualization why the x-component of (1,1) becomes cos(x)-sin(x)? I tried to draw it, but couldn't figure it out.
• I feel you. This transformation works for any vector and for any angle, but the only ones I have any "spatial" understanding of are i and j.

I can tell you this - that since T(x) + T(y) = T(x+y), then A(i+j) = Ai + Aj = (cost, sint) + (-sint, cost) = (cost-sint, sint+cost). It seems that the transformation of the sum of the 2 unit vectors = the sum of the 2 column vectors of the transformation.

Wait... If you sketch i+j, then sketch a rotation of i+j, you can see clearly that T(i+j) is T(i) + T(j) (at least it seems like that to me). So this gives visual support for the specific formula for rotating i, j, and "i+j = (1, 1)", your question.