# Compute the product of two quaternions

Show that if $$q_1 = s_1 + v_1$$ and $$q_2 = s_2 + v_2$$ are two quaternions with scalar parts $$s_1, s_2,$$ and vector parts $$v_1, v_2$$, then their product is the quaternion with the following simplification rules:

$$i^2=j^2=k^2=-1$$,

$$ij=k=-ij$$,

$$jk=i=-kj$$,

$$ki=j=-ik$$

$$q_1 q_2 = (s_1s_2 - v_1 \cdot v_2) + (s_1v_2 + s_2v_1 + v_1 \times v_2)$$

I figured I would use distributive multiplication on $$q_1$$ and $$q_2$$ and so far I have

$$q_1 = (a_1 + b_1i + c_1j + d_1k)$$ and $$q_2 = (a_2 + b_2i + c_2j + d_2k)$$

\begin{align} q_1q_2 &= a_1a_2 + a_1b_2i + a_1c_2j + ad_2k + \\ & a_2b_1i + b_1b_2i^2 + b_1c_2ij + b_1d_2ki + \\ & c_1a_2j + c_1b_2ji + c_1c_2j^2 + c_1d_2ik + \\ & d_1a_2k + d_1b_2ki + d_1c_2kj + d_1d_2k^2 \end{align}

However when I try to simplify further from this point, I feel like I am making copious amounts of mistakes and am struggling to stay organized. Is there a better way to go about doing this or at least organizing my work to get to the end?

Instead of expanding everything at once, it might help you keep things organized to delay expanding the vector part. Writing $$q$$ as the sum $$s + \mathbf v$$ as suggested, it shouldn’t be hard to convince yourself that quaternion multiplication distributes over $$+$$. So, $$(s_1+\mathbf v_1)(s_2+\mathbf v_2) = s_1s_2 + s_1\mathbf v_2 + s_2\mathbf v_1 + \mathbf v_1\mathbf v_2.$$ The first term $$s_1s_2$$ is a scalar while $$s_1\mathbf v_2$$ and $$s_2\mathbf v_1$$ are vectors, so after grouping them the expanded product looks like $$(s_1s_2 + \dots)+(s_1\mathbf v_2+s_2\mathbf v_1+\dots).$$ You’re then left with working out the quaternion product $$\mathbf v_1\mathbf v_2$$ of two pure vectors. Fully expanded, this product consists of nine terms instead of your original sixteen, so should be much easier to manage.

I like the approach that amd has used above, and suggest you give it a look.

However, from where you are.

\begin{align} q_1q_2 &= a_1a_2 + a_1b_2i + a_1c_2j + ad_2k + \\ & a_2b_1i + b_1b_2i^2 + b_1c_2ij + b_1d_2ki + \\ & c_1a_2j + c_1b_2ji + c_1c_2j^2 + c_1d_2jk + \\ & d_1a_2k + d_1b_2ki + d_1c_2kj + d_1d_2k^2 \end{align}

replace $$i^2, j^2, k^2$$ with $$-1$$ and $$ij = k, ji = -k,$$ etc. we get

\begin{align} q_1q_2 &= a_1a_2 + a_1b_2i + a_1c_2j + ad_2k + \\ & a_2b_1i - b_1b_2 + b_1c_2k - b_1d_2j + \\ & c_1a_2j - c_1b_2k - c_1c_2 + c_1d_2i + \\ & d_1a_2k + d_1b_2j + d_1c_2kj - d_1d_2 \end{align}

Collect the real parts and the $$i,j, k$$ parts

\begin{align} q_1q_2 &= a_1a_2 - b_1b_2 - c_1c_2-d_1d_2+ \\ &(a_1b_2 + a2b1 + c_1d_2 - c_2d_1)i +\\ &(a_1c_2 + a_2c_1 -b_1d_2+b_2d1)j+\\ &(a_1d_2 + a2d_1 + b_1c_2 - b_2c_1)k \end{align}

\begin{align} q_1q_2 &= a_1a_2 - (b_1b_2 + c_1c_2+d_1d_2)+ \\ &a_1(b_2i+c_2j+d_2j) + a_2(b_1i + c_1j+d_1k)+\\ &(c_1d_2-c_2d_1)i + (b_2d_1 - b_1d_2)j + (b_1c_2 - b_2c_1)k \end{align}

$$(b_1b_2 + c_1c_2+d_1d_2) = v_1\cdot v_2$$ and $$(c_1d_2-c_2d_1)i + (b_2d_1 - b_1d_2)j + (b_1c_2 - b_2c_1)k = v_1\times v_2$$