# 4D rotations

This topic is 4425 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

In a 2D rotation, if you rotate a system of two orthogonal axes, both axes have to move, you can't do a 2D rotation where one of the axes stays at it's position. In a 3D rotation however you can rotate a system of three orthogonal axes, and do the rotation around one axis, so that only two of the three axes move. I'm wondering now, in a 4D rotation, is it possible to rotate a system of 4 orthogonal axes so that 2 of those axes remain at their position and 2 move? And in a 5D rotation, is it possible that 3 axes remain at their position while 2 move? And so on...

##### Share on other sites
I would argue that you could rotate around 1 axis. In the case of 2D this axis is not part of the space since it has to be perpendicular to the both available vectors of the basis. In 3D and above it is part of the space, so I assume that you could preserve only 1 axis in all spaces of dimensions greater than 2.

This isn't a proof in the mathematical sense, so I may be wrong...

##### Share on other sites
Please ignore this post. I didn't think it through, and so what I wrote it wrong.[/edit]

All axes are orthogonal, so if you rotate along one axis, that axis will remain and all others will move, regardless of the dimensions.

Remember, for 2D rotations you are basically extending the system into 3 dimensions and rotating along the z-axis, which is why both the x-axis and the y-axis move.

[Edited by - Jaywalk on January 12, 2006 6:45:16 AM]

##### Share on other sites
I think you are mistaken there, Jaywalk.

Rotations in 2d and 3d are tricky! And I'm saying this, because they create the impression that we need an axis to rotate around. This is false. A rotation is a matrix with determinant==1. It doesn't use any axis information, it can directly alter only TWO of the coordinates of the transformed points. Therefore, a rotation works directly on a plane defined by two of the system's axes, not around an arbitrary axis!

In 2d, there is only one rotation matrix, since there is only one plane, the XY plane. The matrix is:
[ cos(a)  -sin(a) ][ sin(a)   cos(a) ]

In 3d, there are three, since there are three planes XY,YZ,XZ ...
         [ cos(a)  -sin(a)    0 ]           [   1      0         0   ]          Rxy(a) = [ sin(a)   cos(a)    0 ], Ryz(a) = [   0   cos(a)   -sin(a) ]          [  0        0        1 ]           [   0   sin(a)    cos(a) ]         [ cos(a)   0   -sin(a) ]Rxz(a) = [   0      1      0    ]         [ sin(a)   0    cos(a) ]

In 4d, there are six planes, XY,XZ,XW,YZ,YW,ZW. Therefore there are 6 matrices:
         [ 1     0     0       0    ]Rzw(a) = [ 0     1     0       0    ]          [ 0     0  cos(a)  -sin(a) ],  etc...         [ 0     0  sin(a)   cos(a) ]

Each of those matrices can only alter two of a point's coordinates. The reason why you can achieve any orientation with one matrix, comes from the fact that you can combine them with multiplication and change base vectors to get the desired effect. However, when viewed as a sequence of rotations, each one affects only a single plane at a time.

Quote:
 I'm wondering now, in a 4D rotation, is it possible to rotate a system of 4 orthogonal axes so that 2 of those axes remain at their position and 2 move?And in a 5D rotation, is it possible that 3 axes remain at their position while 2 move? And so on...

Rotations are -in essence- matrices. However, for each matrix, there is a set of vectors that do not change direction when multiplied with it. They only change length. These vectors are called eigenvectors of the matrix and the respective factor of change of length, is called its eigenvalue. This is expressed as:
M*v == k*v, where M is the matrix, v is the eigenvector and k its eigenvalue.

A 3d rotation matrix must have eigenvectors too. What vectors will they be? Think about it... You have a matrix that rotates 3d vectors, but there are 3 vectors of the space, that aren't affected by the matrix (in terms of direction)
What will they be? Clearly, for a vector to remain unaffected by a rotation matrix, it should be colinear with the axis perpendicular to the plane of rotation.
The matrix that rotates the XY plane in 3d, has eigenvector {0,0,1} with eigenvalue 1. This means, that all vectors colinear with the rotation axis {0,0,1}, do not change at all.
The matrix that rotates the XY plane in 4D, has eigenvectors {0,0,1,0} and {0,0,0,1}, meaning that these two axes, Z and W, (and any vector parallel to them) are unaffected by the matrix
Similarly, the one in 5D, has eigenvectors {0,0,1,0,0}, {0,0,0,1,0} and {0,0,0,0,1}, therefore these three axes remain unaffected by the rotation.
Generally, you can find the plane of any rotation; just find its eigenvectors, they will be all the axes that are perpendicular to that plane, therefore you will be left with the two that define the plane.

Surprisingly (?), the 2D rotation matrix only has 2 eigenvectors, both of which have complex components. They are {-i,1} and {i,1}, with eigenvalues (cos(a)-i*sin(a)) and (cos(a)+i*sin(a)) respectively.
Therefore, a 2d rotation can be thought of, as a rotation around the complex axis, perpendicular to both {-i,1} and {i,1}

##### Share on other sites
So can you say that in a 3D rotation you're rotating around an axis, while in a 4D rotation, you're rotating around a plane, and in higher dimensions you're rotating around hyperplanes?

##### Share on other sites
What you can say is that:
1. In Rn, any orthonormal matrix with determinant==1 is a rotation because it preserves distances and relative position among points. (without introducing reflection, change of system's handed-ness).
2. A single rotation, works on a specific plane designated by two of the system's axes. There will be only two coordinates that will be affected by the rotation.
3. Although it's very intuitive -for us humans- to think that there's is always an axis perpendicular to the plane of rotation, the truth is that:

a) there may be none (2d)
b) there may only be one (3d)
c) there may be more than one axis perpendicular to the plane (4D and beyond). In this case, if the dimension of space is n, there will be n-2 axes concurrently perpendicular to the plane of rotation, which will all be eigenvectors of the matrix. The rest 2, will be the original two axes that define the plane of rotation in the first place.
There will also be 2 eigenvectors, for 2 complex axes.

edit:
fixed a mistake in (c)
edit2:
added 'orthonormal' in 1. as suggested by jjd

[Edited by - someusername on January 11, 2006 8:10:41 AM]

##### Share on other sites
someusername: Interesting... What you say makes sense. I stand corrected.

##### Share on other sites
Quote:
 Original post by someusernameWhat you can say is that: 1. In Rn, any matrix with determinant==1 is a rotation because it preserves distances and relative position among points. (without introducing reflection, change of system's handed-ness). 2. A single rotation, works on a specific plane designated by two of the system's axes. There will be only two coordinates that will be affected by the rotation.3. Although it's very intuitive -for us humans- to think that there's is always an axis perpendicular to the plane of rotation, the truth is that:a) there may be none (2d)b) there may only be one (3d)c) there may be more than one axis perpendicular to the plane (4D and beyond). In this case, if the dimension of space is n, there will be n-2 axes concurrently perpendicular to the plane of rotation, which will all be eigenvectors of the matrix. The rest 2, will be the original two axes that define the plane of rotation in the first place.There will also be 2 eigenvectors, for 2 complex axes.edit:fixed a mistake in (c)

Having a determinant of one seems like a necessary condition, but I don't think it is sufficient. For example, take a diagonal matrix with the following entries along the diagonal {1/2,1,1,2}, it's determinant is 1. This is not a rotation and it scales the components. I think it is necessary for the transformation matrix needs to be orthonormal to achieve that you are stating. Note that an orthogonal transformation has a determinant of 1 or -1.

##### Share on other sites
no problem, I just wanted to point out that thinking such concepts -that can be generalized in arbitrary number of dimensions- in 2d or 3d, is usually bad, because they turn out to be over-simplified instances of the original problem and one may end up missing the whole idea.

If you break up an orientation in discrete rotations, they all work on one plane at a time, and -in fact- that plane is defined by the world axes, not arbitrary ones. You'll have to make a similarity transform to another orientation, to force the rotation to change plane.

This is also how quaternions work. Given any two quaternions Q1,Q2, you can always find two orthogonal rotations (rotations that don't affect the planes of each other) that have the same effect as the rotation Q1*v*Q2, on the 4-vector v

To be honest though, I'm having a little trouble understanding the meaning of the complex axes in the eigenvectors...

##### Share on other sites
Quote:
 Original post by LodeSo can you say that in a 3D rotation you're rotating around an axis, while in a 4D rotation, you're rotating around a plane, and in higher dimensions you're rotating around hyperplanes?

no, thats exactly not the point of the above post.

all rotations take place IN a plane.

the rotation acts AROUND everything that is peripendicular to said plane, an n-2 dimensional space. in 2d thats a point, in 3d an axis, and in 4d, hard to imagine as it is, a plane.

btw, not only 2d rotation matrices have complex eigenvalues. all rotation matrices have 2 complex eigenvalues/vectors, but for higher dimensions, there are also an n-2 set of real, non-rotating eigendirections

##### Share on other sites
@jjd
Clearly, for any two row-vectors (or column vectors) in the matrix, the following should hold:
1. vi.vj = 0, i,j=1,...,n, i!=j,
2. |vi|=1, i=1,...,n

I neglected to mention that

##### Share on other sites
Quote:
Original post by Eelco
Quote:
 Original post by LodeSo can you say that in a 3D rotation you're rotating around an axis, while in a 4D rotation, you're rotating around a plane, and in higher dimensions you're rotating around hyperplanes?

no, thats exactly not the point of the above post.

all rotations take place IN a plane.

the rotation acts AROUND everything that is peripendicular to said plane, an n-2 dimensional space. in 2d thats a point, in 3d an axis, and in 4d, hard to imagine as it is, a plane.

btw, not only 2d rotation matrices have complex eigenvalues. all rotation matrices have 2 complex eigenvalues/vectors, but for higher dimensions, there are also an n-2 set of real, non-rotating eigendirections

Well, then it is what I said, I said "in 4D you rotate around a plane" and you said it too. What you said with "the rotation acts AROUND everything that is peripendicular to said plane, an n-2 dimensional space. in 2d thats a point, in 3d an axis, and in 4d, hard to imagine as it is, a plane." is what I meant.

The complex eigenvalues are confusing my by the way, is a complex 4D space not 8D instead of 4D?

##### Share on other sites
Well, Lode seems to be arguing about the proper way to call it, while Eelco is trying to point out that you shouldn't think of it as "rotation around something", but as "rotation of a plane". I second that, because a plane is always a well-defined entity no matter the dimension.

If you define "rotate around 'something'", as: "The only points of space that remain unaffected by the rotation lie in 'something'", then you could say that -in 2D- rotations are performed around the origin... in 3d around an axis... or around a plane in 4D. However in 5D, three axes remain unaffected. Three axes perpendicular to each other are an entire new 3d space, not a hyperplane. (I suppose, by hyperplane, you mean the set of 4d space whose points saqtisfy: Ax+By+Cz+Dw == const.) I'm not sure that would be the proper way to call it.

Anyway, arguing about how to call it, is like missing the forest here

##### Share on other sites
Quote:
 Original post by LodeWell, then it is what I said, I said "in 4D you rotate around a plane" and you said it too. What you said with "the rotation acts AROUND everything that is peripendicular to said plane, an n-2 dimensional space. in 2d thats a point, in 3d an axis, and in 4d, hard to imagine as it is, a plane." is what I meant.

yeah, you did reach the correct conclusion. only i felt your summary missed the essence of someusername post, being that its better to view rotations as taking part in a plane, rather than defining them by the space they rotate around.

ive had some confusing discussions in the past, when i didnt properly understand the concept myself. my teachers would refuse to explain me a 2d problem outside of the context of a slice of a 3d one: they would always talk about rotating things about the z-axis. which i found confusing, with there being no z-axis is a real 2d problem. i always felt a rotation should be possible and well defined without an appeal to a dimension you are not even considering.

appearently it is not even inituatively obvious how to translate the problem of rotation to a lower dimension without clinging to the concept of an axis, that only applies in 3d. its better to let go of such a 3d-centric way of thinking sooner rather than later.

i believe hyperplane is the right term btw. a volume can be considered a hyperplane. so rotating in 5d would happen 'around' a volume...

##### Share on other sites
You can read about a generalization to n-dimensional rotation here, it's called a Special orthogonal group.

Here's an intuitive way to look at it...

We can define rotation as an even number of mirror operations.
A mirror operation is where you "flip" your space around some hyperplane.
( Reminder: a hyperplane in 5D is a 4D sub-space )

For example, in 2d, if you take an object, flip it once about some arbitrary line and then flip it again around yet another arbitrary line, you get a rotation.

In any dimension, a matrix that represents a flip is an orthogonal matrix that has a determinant of -1.

Since we require that a rotation will be a composition of an even number of flips, a rotation matrix is an orthogonal matrix that has a determinant of 1, due to the following identity: |A*B|=|A|*|B|.

It works the other way around too. That is, any orthogonal matrix that has a determinant of 1 is a rotation matrix.

Now please remind me, why on earth would you need that? :)

##### Share on other sites
Quote:
 Original post by uryNow please remind me, why on earth would you need that? :)

Some algorithm that does rotations in 65536 dimensions (for 256 * 256 images) which has to do with Principal Component Analysis.

##### Share on other sites
Quote:
 Original post by someusernameTo be honest though, I'm having a little trouble understanding the meaning of the complex axes in the eigenvectors...

I think the difficulty might come from trying to interpret them as axis. Complex numbers in and of themselves can be used a means of 2D analysis, just as real numbers can be used as a means of 1D analysis, but they're both still scalars. So if you think of the complex number as always being a scalar then it makes sense they can be components of a vector, and when you fall back on the definitions of eigenvectors, eigenvalues, and the mechanics of complex number arithmetic everything stays consistent. I find that his happens a lot in mathematics, that you have to fall back on pure definitions and mechanics in order for things to make sense. Otherwise I myself would barely understand higher-dimensional geometry [smile]

##### Share on other sites
Yes, what you in fact do is planar rotations... rotations is sorta "flat". I.e. points of objects go around circle in the plane.
In 3D it happens that axis is uniquely orthogonal to plane so you "rotate around axis". But it's not so in other numbers of dimensions.

I wrote some 4D viewer where rotations is done by pressing two buttons specifying axises of plane you do planar rotation in. (order of presses gives the direction). It works in any number of dimensions, so i can rather easily expand my program to support 5D, 6D, etc. and it will even be backward compatible (like first two keys do 2D rotations, first 3 keys do 3D rotations, first 4 keys do 4D rotations, etc.)

##### Share on other sites
Quote:
 Original post by LodeSome algorithm that does rotations in 65536 dimensions (for 256 * 256 images) which has to do with Principal Component Analysis.

As far as I can remember, PCA is equivalent to performing a Singular Value Decomposition (SVD) of the data covariance matrix. SVD produces orthogonal matrices and I am fairly sure that they can have a determinant of -1.

I am probably wrong though... where did you read that?

##### Share on other sites
Quote:
Original post by ury
Quote:
 Original post by LodeSome algorithm that does rotations in 65536 dimensions (for 256 * 256 images) which has to do with Principal Component Analysis.

As far as I can remember, PCA is equivalent to performing a Singular Value Decomposition (SVD) of the data covariance matrix. SVD produces orthogonal matrices and I am fairly sure that they can have a determinant of -1.

I am probably wrong though... where did you read that?

It said that you're "rotating" the data (images and/or statistics?) all the time to get new principal components, each time you rotate this way that you get as much correlation as possible in the next principal component (which is an image that can also be seen as an axis, it's 65536D). So the reason I asked this question is that, if you do each next rotation, I was wondering if the axes you had already rotated towards maximal correlation, would stay at their position (which is of course what we want).

But don't ask me too many details, I'm not a specialist on this subject, and it's only theoretical too because in practice it'd take too many calculations :)