## Complex-pair representation of GA(2,0) multivectors

We found previously that a complex pair representation of a GA(2,0) multivector had a compact geometric product realization. Now that we know the answer, let’s work backwards from that representation to verify that everything matches our expectations.

We are representing a multivector of the form
\label{eqn:bicomplexCl20:20}
M = a + b \Be_1 \Be_2 + x \Be_1 + y \Be_2,

as the pair of complex numbers
\label{eqn:bicomplexCl20:40}
M \sim \lr{ a + i b, x + i y }.

Given a pair of multivectors with this complex representation
\label{eqn:bicomplexCl20:60}
\begin{aligned}
M &= \lr{ z_1, z_2 } \\
N &= \lr{ q_1, q_2 },
\end{aligned}

we found that our geometric product representation was
\label{eqn:bicomplexCl20:80}
M N \sim
\lr{ z_1 q_1 + z_2^\conj q_2, z_2 q_1 + z_1^\conj q_2 }.

Our task is now to verify that this is correct. Let’s set
\label{eqn:bicomplexCl20:100}
\begin{aligned}
z_1 &= a + i b \\
q_1 &= a’ + i b’ \\
z_2 &= x + i y \\
q_2 &= x’ + i y’,
\end{aligned}

and proceed with an expansion of the even grade components
\label{eqn:bicomplexCl20:120}
\begin{aligned}
z_1 q_1 + z_2^\conj q_2
&=
\lr{ a + i b } \lr{ a’ + i b’ }
+
\lr{ x – i y } \lr{ x’ + i y’ } \\
&=
a a’ – b b’ + x x’ + y y’
+ i \lr{ b a’ + a b’ + x y’ – y x’ } \\
&=
x x’ + y y’ + i \lr{ x y’ – y x’ } + \quad a a’ – b b’ + i \lr{ b a’ + a b’ }.
\end{aligned}

The first terms is clearly the geometric product of two vectors
\label{eqn:bicomplexCl20:140}
\lr{ x \Be_1 + y \Be_2 } \lr{ x’ \Be_1 + y’ \Be_2 }
=
x x’ + y y’ + i \lr{ x y’ – y x’ },

and we are able to verify that the second parts can be factored too
\label{eqn:bicomplexCl20:160}
\lr{ a + b i } \lr{ a’ + b’ i }
=
a a’ – b b’ + i \lr{ b a’ + a b’ }.

This leaves us with
\label{eqn:bicomplexCl20:180}

as expected. This part of our representation checks out.

Now, let’s look at the vector component of our representation. First note that to convert from our complex representation of our vector $$z = x + i y$$ to the standard basis representation of our vector, we need only multiply by $$\Be_1$$ on the left, for example:
\label{eqn:bicomplexCl20:220}
\Be_1 \lr{ x + i y } = \Be_1 x + \Be_1 \Be_1 \Be_2 y = \Be_1 x + \Be_2 y.

So, for the vector component of our assumed product representation, we have
\label{eqn:bicomplexCl20:200}
\begin{aligned}
\Be_1 \lr{ z_2 q_1 + z_1^\conj q_2 }
&=
\Be_1 \lr{ x + i y } \lr{ a’ + i b’ }
+
\Be_1 \lr{ a – i b } \lr{ x’ + i y’ } \\
&=
\Be_1 \lr{ x + i y } \lr{ a’ + i b’ }
+
\lr{ a + i b } \Be_1 \lr{ x’ + i y’ } \\
&=
\end{aligned}

as expected.

Our complex-pair realization of the geometric product checks out.

## Motivation.

Suppose that we want to represent GA(2,0) (Euclidean) multivectors as a pair of complex numbers, with a structure like
\label{eqn:bicomplexGA20:20}
M = (m_1, m_2),

where
\label{eqn:bicomplexGA20:40}
\begin{aligned}
\end{aligned}

Specifically
\label{eqn:bicomplexGA20:60}
\begin{aligned}
\gpgrade{M}{1} \cdot \Be_1 &= \textrm{Re}(m_2) \\
\gpgrade{M}{1} \cdot \Be_2 &= \textrm{Im}(m_2) \\
\end{aligned}

where $$i \sim \Be_1 \Be_2$$.

## Multivector product representation.

Let’s figure out how we can represent the various GA products, starting with the geometric product. Let
\label{eqn:bicomplexGA20:80}
\begin{aligned}
M &= \gpgrade{M}{0,2} + \gpgrade{M}{1} = (m_1, m_2) = (m_{11} + m_{12} i, m_{21} + m_{22} i) \\
N &= \gpgrade{N}{0,2} + \gpgrade{N}{1} = (n_1, n_2) = (n_{11} + n_{12} i, n_{21} + n_{22} i),
\end{aligned}

so
\label{eqn:bicomplexGA20:200}
\begin{aligned}
M N
\end{aligned}

The first two terms have only even grades, and the second two terms are vectors. The complete representation of the even grade components of this multivector product is
\label{eqn:bicomplexGA20:240}
\gpgrade{M N}{0,2} \sim \lr{ m_1 n_1 + \textrm{Re}(m_2 n_2^\conj) – i \textrm{Im}(m_2 n_2^\conj), 0 },

or
\label{eqn:bicomplexGA20:260}
\begin{aligned}
\gpgrade{M N}{0} &= \textrm{Re}\lr{ m_1 n_1 + m_2 n_2^\conj } \\
\gpgrade{M N}{2} i^{-1} &= \textrm{Im}\lr{ m_1 n_1 – m_2 n_2^\conj }.
\end{aligned}

For the vector components we have
\label{eqn:bicomplexGA20:280}
\begin{aligned}
&=
+
\end{aligned}

For these,
\label{eqn:bicomplexGA20:300}
\begin{aligned}
&= \lr{ m_{21} \Be_1 + m_{22} \Be_2 } \Be_{12}
&= – m_{22} \Be_1 + m_{21} \Be_2,
\end{aligned}

and
\label{eqn:bicomplexGA20:320}
\begin{aligned}
&= \Be_{12} \lr{ n_{21} \Be_1 + n_{22} \Be_2 }
&=
n_{22} \Be_1 – n_{21} \Be_2.
\end{aligned}

Comparing to
\label{eqn:bicomplexGA20:340}
i (a + i b)
= -b + i a,

we see that
\label{eqn:bicomplexGA20:360}
\sim
\lr{ 0, n_{11} m_2 + m_{11} n_2 + n_{12} i m_2 – m_{12} i n_2 }.

If we want the vector coordinates, those are
\label{eqn:bicomplexGA20:380}
\begin{aligned}
\gpgrade{M N}{1} \cdot \Be_1 &= \textrm{Re} \lr{ n_{11} m_2 + m_{11} n_2 + n_{12} i m_2 – m_{12} i n_2 } \\
\gpgrade{M N}{1} \cdot \Be_2 &= \textrm{Im} \lr{ n_{11} m_2 + m_{11} n_2 + n_{12} i m_2 – m_{12} i n_2 }.
\end{aligned}

## Summary.

\label{eqn:bicomplexGA20:n}
M N \sim
\lr{ m_1 n_1 + \textrm{Re}(m_2 n_2^\conj) – i \textrm{Im}(m_2 n_2^\conj), n_{11} m_2 + m_{11} n_2 + n_{12} i m_2 – m_{12} i n_2 }.

A sample Mathematica implementation is available, as well as an example notebook (that also doubles as a test case.)

## Clarification.

I skipped a step above, showing the correspondances to the dot and wedge product.

Let $$z = a + bi$$, and $$w = c + di$$. Then:
\label{eqn:bicomplexGA20:420}
\begin{aligned}
z w^\conj
&=
\lr{ a + b i } \lr{ c – d i } \\
&= a c + b d -i \lr{ a d – b c }.
\end{aligned}

Compare that to the geometric product of two vectors $$\Bx = a \Be_1 + b \Be_2$$, and $$\By = c \Be_1 + d \Be_2$$, where we have
\label{eqn:bicomplexGA20:440}
\begin{aligned}
\Bx \By &= \Bx \cdot \By + \Bx \wedge \By \\
&= \lr{ a \Be_1 + b \Be_2 } \lr{ c \Be_1 + d \Be_2 } \\
&= a c + b d + \Be_1 \Be_2 \lr{ a d – b c }.
\end{aligned}

So we have
\label{eqn:bicomplexGA20:460}
\begin{aligned}
a b + cd &= \Bx \cdot \By = \textrm{Re} \lr{ z w^\conj } \\
a d – b c &= \lr{ \Bx \wedge \By } \Be_{12}^{-1} = – \textrm{Im} \lr{ z w^\conj }.
\end{aligned}

We see that $$\lr{z w^\conj}^\conj = z^\conj w$$ can be used as a representation of the geometric product of two vectors (setting $$i = \Be_1 \Be_2$$ as usual.)

## Another simplification.

We have sums of the form
\label{eqn:bicomplexGA20:480}
\textrm{Re}(z) w \pm \textrm{Im}(z) i w

above. Let’s see if those can be simplified. For the positive case we have
\label{eqn:bicomplexGA20:500}
\begin{aligned}
\textrm{Re}(z) w + \textrm{Im}(z) i w
&=
\inv{2} \lr{ z + z^\conj } w + \inv{2} \lr{ z – z^\conj } w \\
&=
z w,
\end{aligned}

and for the negative case, we have
\label{eqn:bicomplexGA20:520}
\begin{aligned}
\textrm{Re}(z) w – \textrm{Im}(z) i w
&=
\inv{2} \lr{ z + z^\conj } w – \inv{2} \lr{ z – z^\conj } w \\
&=
z^\conj w.
\end{aligned}

This, with the vector-vector product simplification above, means that we can represent the full multivector product in this representation as just
\label{eqn:bicomplexGA20:540}
M N \sim
\lr{ m_1 n_1 + m_2^\conj n_2, m_2 n_1 + m_1^\conj n_2 }.

## Inscribed circle in a triangle

June 12, 2023 Uncategorized

## Motivation

In Jim Smith’s recent Handling Rejection! Using Geometric Algebra to Find the Incircle of a Triangle video, he uses an area argument to find the center point of a circle inscribed in a triangle, as illustrated in fig. 1.

fig. 1. Triangle with inscribed circle.

In the video, Jim mentioned that he first tried calculating the intersection of the bivectors, but didn’t like the form of the solution. I’m curious what aspect of that solution wasn’t desirable, since it is a pretty compact way to solve the system.

## Setup.

A very convenient way to describe a triangle is with a pair of vectors for two of the edges, say $$\Ba, \Bb$$, where the third edge is $$\Bc = \Ba -\Bb$$. In Jim’s problem, he started with the scalar lengths of all the edges $$a, b, c$$. The two representations are interchangable. We can set
\label{eqn:triangleInscribedCircle:n}\
\begin{aligned}
\Ba &= a\Be_1 \\
\Bb &= b \Be_1 e^{i\theta_c},
\end{aligned}

where $$i = \Be_1 \Be_2$$, and $$\theta_c$$ is the angle opposite edge $$\Bc$$, which can be found from the cosine law
\label{eqn:triangleInscribedCircle:20}
\Bc^2 = \lr{ \Ba – \Bb }^2 = \Ba^2 + \Bb^2 – 2 \Ba \cdot \Bb = a^2 + b^2 – 2 a b \cos\theta_c,

or
\label{eqn:triangleInscribedCircle:40}
\theta_c = \cos^{-1} \lr{ \frac{a^2 + b^2 – c^2}{2 a b} }.

## The center point.

The points on our bisectors are
\label{eqn:triangleInscribedCircle:60}
\begin{aligned}
r_c(t) &= t \lr{ \mathbf{\hat{a}} + \mathbf{\hat{b}} } \\
r_b(t) &= \Ba + t \lr{ \mathbf{\hat{a}} + \mathbf{\hat{c}} } \\
r_a(t) &= \Bb + t \lr{ \mathbf{\hat{c}} – \mathbf{\hat{b}} }.
\end{aligned}

We can find the intersection of any two of these to find the center point of the circle. For example, we seek solutions of
\label{eqn:triangleInscribedCircle:80}
u \lr{ \mathbf{\hat{a}} + \mathbf{\hat{b}} } = \Ba + v \lr{ \mathbf{\hat{a}} + \mathbf{\hat{c}} }.

We can wedge this with either of the $$u, v$$ vector factors, to eliminate one of the scalars in this equation. Seeking $$u$$, we wedge with $$\mathbf{\hat{a}} + \mathbf{\hat{c}}$$, for
\label{eqn:triangleInscribedCircle:100}
u \lr{ \mathbf{\hat{a}} + \mathbf{\hat{c}} } \wedge \lr{ \mathbf{\hat{a}} + \mathbf{\hat{b}} } = \lr{ \mathbf{\hat{a}} + \mathbf{\hat{c}} } \wedge \Ba = \mathbf{\hat{c}} \wedge \Ba.

so
\label{eqn:triangleInscribedCircle:120}
\Bz = \lr{ \mathbf{\hat{a}} + \mathbf{\hat{b}} } \lr{ \lr{ \mathbf{\hat{c}} \wedge \Ba } \cdot \inv{ \lr{ \mathbf{\hat{a}} + \mathbf{\hat{c}} } \wedge \lr{ \mathbf{\hat{a}} + \mathbf{\hat{b}} } } }.

Having found the center, we can calculate the radius that touches the $$a$$ edge, which is just
\label{eqn:triangleInscribedCircle:140}
\mathrm{Rej}_{\Ba}(\Bz) = \lr{ \Bz \wedge \mathbf{\hat{a}} } \cdot \mathbf{\hat{a}}.

\label{eqn:triangleInscribedCircle:160}
r = \Norm{ \Bz \wedge \mathbf{\hat{a}} }.

## Calculation.

Using a Mathematica Manipulate, I plotted this solution, employing a duality transformation to calculate the bivectors using cross products (avoiding any GA package dependencies.)

For the radius, we need only:
\label{eqn:triangleInscribedCircle:200}
r = \Norm{ \Bz \cross \mathbf{\hat{a}} }.

For the intersection, we can use:
\label{eqn:triangleInscribedCircle:180}
\Bz = \lr{ \mathbf{\hat{a}} + \mathbf{\hat{b}} } \lr{ \lr{ \mathbf{\hat{c}} \cross \Ba } \cdot \inv{ \lr{ \mathbf{\hat{a}} + \mathbf{\hat{c}} } \cross \lr{ \mathbf{\hat{a}} + \mathbf{\hat{b}} } } }.

In retrospect, just using a ratio of the determinants of the coordinates would have been a direct representation of the ratio of the wedge products, so I could have done that instead to translate the results from GA to Mathematica (since this is a planar problem.)  The wedge products could have also been encoding using complex numbers (in the newest version of the notebook, I’ve done that.)

Of course, using Mathematica, we could have just used it’s more general $$\textrm{Solve}$$ function, and need not grow our own wedge product based implementation.