### Designing Geometric Algebras - Shapes

Typically we choose a Geometric Algebra that will work well with our problem. First there are the object types the different GAs can represent. If we want flat objects such as lines and planes going through the origin ordinary GA works. If we additionally want the objects to be at arbitrary positions PGA is a good choice. For spheres we can choose CGA which can directly represent them. Secondly we might need certain operations which also dictates our choice of GA. Ordinary GA has rotors that can do rotations only. With both PGA and CGA we get rotors which can do translation and rotation. Below is a table of a few already explored GAs and their properties.
NameSignatureObjectsRotors
Ordinary GAN, 0, 0Flat (through origin)Rotation
Projective Geometric AlgebraN, 0, 1FlatRotation, Translation
Conformal Geometric AlgebraN+1, 1, 0Flat, RoundRotation, Translation
Conic Geometric Algebra5, 3, 0Conics (2D)Rotation, Translation, Uniform scaling
So if what we need is contained in one of these we can simply use them and benefit from the previous exploration done within them. What if we need something that is not contained in one of these pre-made GAs though? Is there a way to create exactly what we need? In the first part of this article we will try to figure out how to create a GA that contains the objects we want. Specifically we will try to create a GA containing arbitrary polynomial shapes such as parabolas and elliptic curves. In the second part we will also look at the rotors.

#### How are objects represented outside of GA?

Before jumping into GA we should take a step back and remember how we represented objects in algebra before.
Usually we represent a 2D line by the linear equation$y=ax+b$, a circle at the origin by${x}^{2}+{y}^{2}={r}^{2}$and so on. Rearranging this a bit to bring everything to the same side we get equivalently$ax+b-y=0$and${x}^{2}+{y}^{2}-{r}^{2}=0$. The object is then represented by all the points$\left(x,y\right)$for which these equations are true, that is, for which the left hand side evaluates to zero. We call this the null space or kernel of the function.

#### Object representation in GA

Now jumping to GA, in 2D PGA a point is represented by a bivector$x{e}_{0y}+y{e}_{x0}+1{e}_{xy}$and a line is represented by a vector$x{e}_{x}+y{e}_{y}-d{e}_{0}$. Let's call the mapping for points the$up$function:$\begin{array}{}\text{(1)}& up:{\mathbb{R}}^{N}↦\mathbb{Cl}\left(...\right)\end{array}$Here's a table of the previously mentioned algebras and their up functions. Note that some of these use a dual representation for points (points as pseudovectors) and some use the usual representation (points as vectors).
NameUp
Ordinary GA$x{e}_{x}+y{e}_{y}+z{e}_{z}+...$
Projective Geometric Algebra$x{e}_{x}^{\ast }+y{e}_{y}^{\ast }+...+1{e}_{0}^{\ast }$
Conformal Geometric Algebra$1{e}_{o}+x{e}_{x}+y{e}_{y}+...+\frac{1}{2}\left({x}^{2}+{y}^{2}+...\right){e}_{\mathrm{\infty }}$
Conic Geometric Algebra${e}_{o+}+x{e}_{x}+y{e}_{y}+\frac{1}{2}\left({x}^{2}+{y}^{2}\right){e}_{\mathrm{\infty }+}+\frac{1}{2}\left({x}^{2}-{y}^{2}\right){e}_{\mathrm{\infty }+}+xy{e}_{\mathrm{\infty }×}$
Quadric Geometric Algebra$x{e}_{x}+...+\frac{1}{2}\left({x}^{2}{e}_{\mathrm{\infty }1}+...\right)+xy{e}_{\mathrm{\infty }4}+...+1{e}_{o1}+...$
How do we connect these representations to the usual null-space representation? There are two almost equivalent ways of doing this.
##### Inner Product Null Space Representation
The first one is the Inner Product Null Space (IPNS) representation. Here we say that the inner product of our object, let's call it$o$, is zero for an arbitrary point produced by our up function.$\begin{array}{}\text{(2)}& up\left(...\right)\cdot o=0\end{array}$The IPNS representation has the downside that we need to define a metric so the inner product works. This means that the representation depends on what our basis vectors square to. This also doesn't work for degenerate metrics such as the one used by PGA.
##### Outer Product Null Space Representation
The second representation is the Outer Product Null Space (OPNS) representation. Instead of the inner product we use the outer product which means we don't need to define a metric either and this will work the same regardless of what our basis vectors square to. We wedge our object$o$with an arbitrary point produced by our up function.$\begin{array}{}\text{(3)}& up\left(...\right)\wedge o=0\end{array}$The intuition here is that if points are represented by vectors then$\wedge$represents the join operation. If we try to join a point that already lies on the object we get zero. Note that if we're using a dual representation (points as pseudovectors) then we need to use$\vee$instead as that is then the join operation (maybe a better name would then be the Vee Product Null Space (VPNS)? Or Join Null Space (JNS) for the general case).
We will continue using OPNS from now on and apply it to recover more familiar equations for the objects.
##### Example: OPNS applied to PGA 2D
Let's apply the OPNS equation to see what a vector in 2D PGA represents. For the arbitrary$X$we need to use a pseudovector. The$up\left(x,y\right)$function gives us a pseudovector (bivector in this case) so let's use it in place of$X$and remember that we need to use$\vee$for dual representations.$\begin{array}{rl}up\left(x,y\right)\vee vector& =\left(x{e}_{0y}+y{e}_{x0}+1{e}_{xy}\right)\vee \left(a{e}_{x}+b{e}_{y}+d{e}_{0}\right)\\ & =ax+by+d=0\end{array}$We have recovered the usual equation for a line. Unlike the previous one, this one also has a coefficient for$y$which makes it possible to represent vertical lines (by setting$b=0$we get$ax=-d$). Hence the vectors in 2D PGA represent lines.
What happens when we apply the OPNS to PGA points (pseudovectors, bivectors in 2D)?$\begin{array}{rl}up\left(x,y\right)\vee point& =\left(x{e}_{0y}+y{e}_{x0}+1{e}_{xy}\right)\vee \left(a{e}_{0y}+b{e}_{x0}+c{e}_{xy}\right)\\ & =bx{e}_{0}+cx{e}_{y}-ay{e}_{0}+cy{e}_{x}-a{e}_{y}-b{e}_{x}\\ & ={e}_{y}\left(cx-a\right)+{e}_{x}\left(cy-b\right)+{e}_{0}\left(bx-ay\right)\end{array}$We get three equations that have to vanish, only two of which are independent.$\begin{array}{rlr}& cx-a=0& \phantom{\rule{0.278em}{0ex}}⟹\phantom{\rule{0.278em}{0ex}}x=\frac{a}{c}\\ & cy-b=0& \phantom{\rule{0.278em}{0ex}}⟹\phantom{\rule{0.278em}{0ex}}y=\frac{b}{c}\\ & bx-ay=b\frac{a}{c}-ay=0& \phantom{\rule{0.278em}{0ex}}⟹\phantom{\rule{0.278em}{0ex}}y=\frac{b}{c}\end{array}$The coordinates we extract get divided by the${e}_{xy}$part of the point. We automatically get homogeneous space and projective points just by defining the up function the way we did with the constant coefficient term$1{e}_{xy}$.
As a final note, applying OPNS is like finding an inverse for the up function. For points it indeed gives the inverse mapping (ie. as if we just inverted the function directly) but the OPNS also generalizes it to apply to elements other than points in a consistent manner.

#### Representing polynomials in GA

Looking at how we arrived at the equation for a line from the OPNS equation we can see that the coefficients$a,b,d$came from the object whose representation we're trying to understand, but the variables$x$,$y$and$1$(for$d$) came from how we defined the$up$function. This means that if we wanted to represent different shapes we need to change the$up$function.
As an example, if we wanted to represent parabolas, we would need to have a basis vector that has${x}^{2}$as a coefficient in$up$. For example$up\left(x,y\right)={x}^{2}{e}_{0y}+y{e}_{x0}+1{e}_{xy}$would give us$a{x}^{2}+by+d=0$after applying the OPNS equation.
Another interesting observation here is that we have a constant term in the polynomial which comes from the fact that we add a constant bivector$1{e}_{xy}$in the up function. This allows PGA to represent translated objects unlike ordinary GA which can only represent objects through the origin.
Furthermore the number of basis vectors is arbitrary. For each term we want we can simply add another basis vector with our desired coefficient. Finally as already mentioned before, the OPNS does not depend on the metric so the interpretation works regardless of what the basis vectors square to.
##### Example: Elliptic curves in GA
Looking at the Wikipedia article for elliptic curveswe can find that the equation for an elliptic curve is${y}^{2}={x}^{3}+ax+b1$. So to represent them we need 4 terms in our up function with coefficients${y}^{2},{x}^{3},x,1$. As a result we will need 4 basis vectors (with any signature).$\begin{array}{rl}up\left(x,y\right)& ={x}^{3}{e}_{1}^{\ast }+{y}^{2}{e}_{2}^{\ast }+x{e}_{3}^{\ast }+1{e}_{4}^{\ast }\\ & ={x}^{3}{e}_{234}+{y}^{2}{e}_{134}+x{e}_{124}+1{e}_{123}\end{array}$Vectors will now be able to represent elliptic curves as well as other simpler curves (parabolas, cubics, lines, ...). You can verify this by hand (or ideally using symbolic math software) by applying the OPNS equation to a vector as before in the 2D PGA example.

#### Join and meet

If points are represented by vectors the join is$\wedge$and meet is$\vee$. In algebras that uses a dual representation for points such as PGA this is swapped and join is$\vee$and meet is$\wedge$.
Something interesting happens when we look at the meet operation which returns the intersection object of two objects. In PGA when we intersected two straight lines we get a single point (or point at infinity if the lines are parallel). However with more complicated curves such as parabolas or elliptic curves we will get more than one intersection point. For example intersecting a parabola with a line (assuming they intersect) will result in two points. However the representation for such a point pair is identical to the representation of a single point in PGA. The difference will only be visible once we apply the OPNS equation to find out what our object is actually representing.
##### Example: parabola at origin intersects horizontal line
Let's apply what we have just learnt and look at some actual results to see if they make sense. We want to intersect a parabola at the origin of the form$y=a{x}^{2}$with a horizontal line of the form$y=c1$. We would expect the intersection to contain 2 points (assuming they intersect).
From the two equations we see that we need the terms${x}^{2}$,$y$and$1$and thus we require 3 basis vectors. We'll use a dual representation (points as pseudovectors) and define our up function as follows$\begin{array}{rl}up\left(x,y\right)& ={x}^{2}{e}_{1}^{\ast }+y{e}_{2}^{\ast }+1{e}_{3}^{\ast }\\ & ={x}^{2}{e}_{23}+y{e}_{31}+1{e}_{12}\end{array}$Now curves should be represented by vectors. For our parabola$p$we need the${x}^{2}$and$y$basis vectors, that is${e}_{1}$and${e}_{2}$respectively. For our line$l$we will need the$y$and$1$basis vectors, that is${e}_{2}$and${e}_{3}$respectively.$\begin{array}{rl}p& =a{e}_{1}-{e}_{2}\\ l& =-{e}_{2}+b{e}_{3}\end{array}$Let's look at the OPNS (using$\vee$) for$p$to confirm it indeed represents the desired parabola.$\begin{array}{rl}up\left(x,y\right)\vee p& =\left({x}^{2}{e}_{1}^{\ast }+y{e}_{2}^{\ast }+1{e}_{3}^{\ast }\right)\vee \left(a{e}_{1}-{e}_{2}\right)\\ & =a{x}^{2}-y=0\end{array}$$\begin{array}{rl}up\left(x,y\right)\vee l& =\left({x}^{2}{e}_{1}^{\ast }+y{e}_{2}^{\ast }+1{e}_{3}^{\ast }\right)\vee \left(-{e}_{2}+b{e}_{3}\right)\\ & =b-y=0\end{array}$Looks like we're good! Now we can intersect the two objects using$\wedge$as that is the meet operation in the dual representation. We will call the intersection object$i$.$\begin{array}{r}i=p\wedge l=-a{e}_{12}+ab{e}_{13}-b{e}_{23}\end{array}$Now let's look at the OPNS of the intersection object to see if it gives us what we expect (two points of intersection).$\begin{array}{rl}up\left(x,y\right)\vee i& =\left({x}^{2}{e}_{1}^{\ast }+y{e}_{2}^{\ast }+1{e}_{3}^{\ast }\right)\vee \left(-a{e}_{12}+ab{e}_{13}-b{e}_{23}\right)\\ & =a\left(-b+y\right){e}_{1}+\left(-a{x}^{2}+b\right){e}_{2}+b\left(a{x}^{2}-y\right){e}_{3}=0\end{array}$Now we have three vectors that need to each be equal to zero.$\begin{array}{rl}a\left(-b+y\right)=0& \phantom{\rule{0.278em}{0ex}}⟹\phantom{\rule{0.278em}{0ex}}y=b\\ \left(-a{x}^{2}+b\right)=0& \phantom{\rule{0.278em}{0ex}}⟹\phantom{\rule{0.278em}{0ex}}{x}^{2}=\frac{b}{a}\\ b\left(a{x}^{2}-y\right)=0& \phantom{\rule{0.278em}{0ex}}⟹\phantom{\rule{0.278em}{0ex}}{x}^{2}=\frac{y}{a}\end{array}$The three equations aren't independent (combining the first and third one gives the second one). So now we see that the intersection object represents${x}^{2}=\frac{b}{a}$and$y=b$. This has two solutions${x}_{1,2}=±\sqrt{\frac{b}{a}}$as expected and the solutions are the correct ones too (eg.$y$is just the vertical offset$b$of the line).
Great, we have shown that what we learnt makes sense and can be applied without much thought required. We can even plot the solutions using a library that can plot the null space of the algebraic equations implicitly.
##### Example: Intersecting Elliptic Curves
Here's another fun example to demonstrate join and meet on elliptic curves.We have a dynamic black curve that interpolates between the blue and the red one using rotors which will be explained in the next part. The black curve intersected with the red curve gives the green points. The teal points oscillate around the center. Teal joined with green gives the pink curve.

#### Conclusion

We have learnt how to represent arbitrary polynomials using GA and that intersection and joining them works and makes sense. There are some other things that we could explore. For example nothing stops us from using more complicated up functions than polynomials and there is no reason they should not make sense anymore.
The major thing we are still missing are operations on objects such as rotation and translation for which we want rotors. For these the metric and whether we use a dual representation or not will actually matter. That will be the topic of the next section.