rotations are where GA pays off first. a reflection is one product, two reflections are a rotation, and the result is the rotor - which works in any dimension, composes by plain multiplication, and has the axis and angle right there in it. quaternions are exactly this, with the geometry put back
reflections
take a unit vector n, and the mirror plane perpendicular to it. the reflection of v in that plane is
v′=−nvn
the part of v along n flips, the part in the mirror stays - exactly what a mirror does
why it works
split v into the part along n and the part in the mirror (part 2), v=v∥+v⊥:
v∥ commutes with n (parallel vectors do), so −nv∥n=−v∥nn=−v∥ - flipped
v⊥ anticommutes with n, so −nv⊥n=v⊥nn=v⊥ - untouched
compare the standard (Householder) formula v−2(v⋅n)n - same thing, but −nvn works on any multivector, not just vectors. reflect a bivector, and you get the mirrored plane
example - a diagonal mirror
n=21(e1+e2), so the mirror is the plane x=−y. reflect v=e1, using e21e1=e2 and e21e2=−e1:
from sympy import sqrt
from galgebra.ga import Ga
g3, e1, e2, e3 = Ga.build('e1 e2 e3', g=[1,1,1])
n =(e1 + e2)/sqrt(2)print(-n*e1*n)# -e2
two mirrors make a rotation
reflect in n's mirror, then in m's. the two minus signs cancel:
v′′=−m(−nvn)m=(mn)v(nm)
and two mirrors at an angle α give a rotation by 2α - any kaleidoscope shows it. each reflection reverses the turning sense, so two of them preserve it, and what's left is a turn in the plane of n and m
mirrors 30° apart turn v by 60° - twice the angle between them
rotors
the product of two unit vectors is the rotorR=mn, and the other side is its reverse, nm=R. with part 1's polar form - the angle between the mirrors is half the rotation angle θ, and B is the unit bivector of the rotation plane, oriented in the turning sense:
R=cos2θ−Bsin2θ=e−Bθ/2,v′=RvR
the exponential works the same as eiφ=cosφ+isinφ, since B2=−1. and RR=1, so a rotor never changes lengths
the rotor sits on both sides of v, and each side does half the work - the part of v in the plane turns by the full θ, the part along the axis stays put
why half the angle
split v again, now against the plane B:
the part in the plane anticommutes with B, so it can be moved through R=cos2θ+Bsin2θ by flipping that sign - v∥R=Rv∥. so Rv∥R=R2v∥=e−Bθv∥ - two halves, one full rotation by θ
the part perpendicular to the plane commutes with B, so Rv⊥R=v⊥RR=v⊥ - the two halves cancel, the axis stays put
so the half angle isn't a trick - one-sided multiplication by e−Bθ would rotate the in-plane part fine, but would mess up everything sticking out of the plane. the sandwich does both right. in 2D, where nothing sticks out, e−e12θv alone is enough - it's the complex-number rotation eiθz
rotation about an axis
in 3D, the plane perpendicular to a unit axis u^ is its dual, B=Iu^ (part 2). so a rotation by θ about u^, right-handed, is
R=e−Iu^θ/2=cos2θ−Iu^sin2θ
and that's the unit quaternion: with i,j,k=−Ie1,−Ie2,−Ie3 from part 2, it's cos2θ+(u1i+u2j+u3k)sin2θ - the textbook quaternion rotation, half angle and all. GA just says what its parts are: a scalar and the plane of rotation
example - 90° about the z-axis
u^=e3, so B=Ie3=e12 and R=21(1−e12). rotate v=e1+2e2+3e3 - the half-angle argument ("why half the angle" above) does it without multiplying out the sandwich:
the in-plane part gets R2=21(1−e12)2=21(1−2e12−1)=−e12, so −e12(e1+2e2)=e2−2e1
the 3e3 part stays
v′=−2e1+e2+3e3
the standard way, with the rotation matrix:
010−100001123=−213✓
python check
from sympy import sqrt
from galgebra.ga import Ga
g3, e1, e2, e3 = Ga.build('e1 e2 e3', g=[1,1,1])
R =(1- e1*e2)/sqrt(2)
v = e1 +2*e2 +3*e3
print(R*v*R.rev())# -2*e1 + e2 + 3*e3
composing rotations
rotate by R1, then by R2: R2(R1vR1)R2=(R2R1)v(R2R1), since reversing a product reverses its order. so composing rotations is multiplying rotors, R=R2R1 - and the result is again a rotor, with its axis and angle readable straight from it
example - 90° about z, then 90° about x
R1=21(1−e12) as above, and about x, B=Ie1=e23, so R2=21(1−e23). with e23e12=e2e3e1e2=e31:
the bivector part is −21(e23−e31+e12)=−23⋅31I(e1−e2+e3), and sin60°=23 ✓, so the axis is 31(1,−1,1)
the standard way, the matrix product Rx(90°)Rz(90°):
1000010−10010−100001=001−1000−10
to get the angle out, use the trace, 1+2cosθ=0, so θ=120° ✓. the axis comes from the antisymmetric part, (M32−M23,M13−M31,M21−M12)=(1,−1,1) ✓. same answer - but the matrix hides it, and the rotor just shows it
python check
from sympy import sqrt
from galgebra.ga import Ga
g3, e1, e2, e3 = Ga.build('e1 e2 e3', g=[1,1,1])
R1 =(1- e1*e2)/sqrt(2)# 90° about z
R2 =(1- e2*e3)/sqrt(2)# 90° about x
R = R2*R1
v = e1 +2*e2 +3*e3
print(R)# 1/2 - e1^e2/2 - e1^e3/2 - e2^e3/2print(R*v*R.rev())# -2*e1 - 3*e2 + e3print(R2*(R1*v*R1.rev())*R2.rev())# the same, one at a time
what we have
a reflection in the plane perpendicular to n is −nvn
two reflections make a rotation by twice the angle between the mirrors, the rotor R=e−Bθ/2 applied as RvR
the half angle is because the rotor works from both sides - the in-plane part turns by the full angle, the axis stays
composing rotations is multiplying rotors, and the axis and angle can be read straight from the result
quaternions are 3D rotors, and nothing here is limited to 3D - the same formulas rotate in any dimension, and rotate planes and volumes as well as vectors. in part 7 they turn out to do Lorentz boosts too
next, derivatives - the vector derivative ∇ in GA does divergence and curl in one go