# Quaternion Division

Divide quaternion by another quaternion

## Library

Utilities/Math Operations

## Description

The Quaternion Division block divides a given quaternion by another.

The quaternions have the form of

$q={q}_{0}+i{q}_{1}+j{q}_{2}+k{q}_{3}$

and

$r={r}_{0}+i{r}_{1}+j{r}_{2}+k{r}_{3}.$

The resulting quaternion from the division has the form of

$t=\frac{q}{r}={t}_{0}+i{t}_{1}+j{t}_{2}+k{t}_{3},$

where

$\begin{array}{l}{t}_{0}=\frac{\left({r}_{0}{q}_{0}+{r}_{1}{q}_{1}+{r}_{2}{q}_{2}+{r}_{3}{q}_{3}\right)}{{r}_{0}^{2}+{r}_{1}^{2}+{r}_{2}^{2}+{r}_{3}^{2}}\\ {t}_{1}=\frac{\left({r}_{0}{q}_{1}-{r}_{1}{q}_{0}-{r}_{2}{q}_{3}+{r}_{3}{q}_{2}\right)}{{r}_{0}^{2}+{r}_{1}^{2}+{r}_{2}^{2}+{r}_{3}^{2}}\\ {t}_{2}=\frac{\left({r}_{0}{q}_{2}+{r}_{1}{q}_{3}-{r}_{2}{q}_{0}-{r}_{3}{q}_{1}\right)}{{r}_{0}^{2}+{r}_{1}^{2}+{r}_{2}^{2}+{r}_{3}^{2}}\\ {t}_{3}=\frac{\left({r}_{0}{q}_{3}-{r}_{1}{q}_{2}+{r}_{2}{q}_{1}-{r}_{3}{q}_{0}\right)}{{r}_{0}^{2}+{r}_{1}^{2}+{r}_{2}^{2}+{r}_{3}^{2}}\end{array}$

## Inputs and Outputs

InputDimension TypeDescription

First

Quaternion or vectorContains quaternions in the form of [q0, p0, ..., q1, p1, ... , q2, p2, ... , q3, p3, ...].

Second

Quaternion or vectorContains quaternions in the form of [s0, r0, ..., s1, r1, ... , s2, r2, ... , s3, r3, ...].

OutputDimension TypeDescription

First

Quaternion or vectorContains resulting quaternion or vector of resulting quaternions from division.

The output is the resulting quaternion from the division or vector of resulting quaternions from division.

## References

Stevens, Brian L., Frank L. Lewis, Aircraft Control and Simulation, Wiley–Interscience, 2nd Edition.