0
$\begingroup$

I am not very familiar with quaternions, I was just doing a programming homework were I had to implement quaternions' arithmetic, however I got puzzled by the multiplication of 2 quaternions.

Let's say I have the following:

$a = \alpha_1 + \beta_1i+\gamma_1j+\delta_1k$

$b = \alpha_2 + \beta_2i+\gamma_2j+\delta_2k$

I have been given the following rules $i^2=j^2=k^2=-1$, $ik=-j$, $ij=k$, $ji=-k$, $jk = i$, $ki = j$, $kj = -i$

Doing the algebra I get the following expression for the product of a and b:

$$\alpha_1\alpha_2 - \beta_1\beta_2 - \gamma_1\gamma_2 - \delta_1\delta_2 \\ +i(\alpha_1\beta_2+\beta_1\alpha_2+\gamma_1\delta_2-\delta_1\gamma_2)\\ +j(\alpha_1\gamma_2-\beta_1\gamma_2+\gamma_1\alpha_2+\delta_1\beta_2)\\ +k(\alpha_1\delta_2+\beta_1\gamma_2-\gamma_1\beta_2+\delta_1\alpha_2)$$

However, when I looked for documentation on this operation in some languages such as matlab, the quaternion product has other definition:

http://www.mathworks.com/help/aerotbx/ug/quatmultiply.html

So, when I test my implementation against the example given the result is different. So, Why is that? What is the correct definition?

$\endgroup$
4
  • $\begingroup$ Just set $a=i,b=k$, so $\beta_1=\delta_2=1$ and all others equal zero. Do you get $ab=ik=-j$? $\endgroup$ Commented Sep 13, 2015 at 18:56
  • $\begingroup$ $\beta_1 $ is represented twice times $ \gamma_2 $ is this correct? $\endgroup$ Commented Sep 13, 2015 at 18:57
  • 1
    $\begingroup$ Yep. @theREALyumdub, that duplication is the proble. There should be a $\beta_1\delta_2$ somewhere in there, and only one $\beta_1\gamma_2$. $\endgroup$ Commented Sep 13, 2015 at 18:58
  • $\begingroup$ Does the computation work out correctly now? $\endgroup$ Commented Sep 13, 2015 at 19:00

2 Answers 2

1
$\begingroup$

Your expression for the $j$ term is wrong. It should be: $$ \alpha_1 \gamma_2-\beta_1\delta_2 + \gamma_1 \alpha_2 + \delta_1 \beta_2 $$

$\endgroup$
1
  • 1
    $\begingroup$ Sorry, my mistake. I realized however, that matlab is qr and I had read rq, that is why the - signs seemed changed from my perspective. I finally understood why I was puzzled. $\endgroup$
    – dpalma
    Commented Sep 13, 2015 at 19:43
-2
$\begingroup$

I do not understand quaternions at all, but what I have been told is that multiplication does not commute with quaternions. I suggest perhaps using only the rules given, and not passing to the distributive law as you have done, although that sounds a bit insane.

I believe quaternions can be represented as a matrix algebra in some form, perhaps start with that idea or assume it is true to begin with. That would make computation a lot easier!

Oh yeah and is there a stray gamma in there? :)

$\endgroup$
1
  • 3
    $\begingroup$ The distributive law works as normal for quaternions. You just have to be careful about accidentally commuting things. $\endgroup$
    – Chappers
    Commented Sep 13, 2015 at 18:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .