Physics Library
 An open source physics library
Encyclopedia | Forums | Docs | Random | Template Test |  
Login
create new user
Username:
Password:
forget your password?
Main Menu
Sections

Meta

Talkback

Downloads

Information
[parent] example of quaternion inverse (Example)

Quaternion Inverse: Examples, Exercises, and Solutions

This entry is the self study companion to quaternion inverse.

The quaternion inverse combines the conjugate and norm into the quantity that undoes quaternion multiplication. For unit attitude quaternions the inverse reduces to the conjugate, but for a general nonzero quaternion the norm squared in the denominator is essential.

All exercises are stated first. Complete worked solutions follow afterward.

Formula summary

For a nonzero quaternion

$\displaystyle q = q_w + q_x\mathbf i + q_y\mathbf j + q_z\mathbf k,$ (1)

the inverse is

$\displaystyle q^{-1} = \frac{q^*}{\lVert q\rVert^2}.$ (2)

Because

$\displaystyle q q^* = q^*q = \lVert q\rVert^2,$ (3)

we have

$\displaystyle q q^{-1} = q^{-1}q = 1.$ (4)

The inverse of a product reverses factor order:

$\displaystyle (pq)^{-1} = q^{-1}p^{-1}.$ (5)

For a unit quaternion,

$\displaystyle \lVert q\rVert=1$ (6)

and therefore

$\displaystyle q^{-1}=q^*.$ (7)

For the PhysicsLibrary passive attitude convention,

$\displaystyle {}^{A}q_B = ({}^{B}q_A)^{-1} = ({}^{B}q_A)^*.$ (8)

Exercises

  1. Direct inverse calculation.

    For

    $\displaystyle q = 2 - \mathbf i + 2\mathbf j + 2\mathbf k, $

    compute

    $\displaystyle q^*, \qquad \lVert q\rVert^2, \qquad q^{-1}. $
  2. Verify both inverse identities.

    Using the quaternion from Exercise 1, compute

    $\displaystyle q q^{-1} $

    and

    $\displaystyle q^{-1}q. $

    Verify that both equal the multiplicative identity.

  3. Unit quaternion simplification.

    Let

    $\displaystyle q = \frac12 \left( 1-\mathbf i-\mathbf j-\mathbf k \right). $

    First verify that $q$ is unit.

    Then compute $q^{-1}$ and show that

    $\displaystyle q^{-1}=q^*. $
  4. Real and pure quaternion inverses.

    Find the inverse of the real quaternion

    $\displaystyle r=-4 $

    and the pure quaternion

    $\displaystyle v = 2\mathbf i-\mathbf j+2\mathbf k. $

    Show that the inverse of a nonzero pure quaternion may be written

    $\displaystyle v^{-1} = -\frac{v}{\lVert v\rVert^2}.$ (9)
  5. Why the zero quaternion has no inverse.

    Explain why

    $\displaystyle q=0 $

    cannot have a multiplicative inverse.

    Relate the failure to the denominator in

    $\displaystyle q^{-1} = \frac{q^*}{\lVert q\rVert^2}. $
  6. Inverse of a product.

    Prove

    $\displaystyle (pq)^{-1} = q^{-1}p^{-1}$ (10)

    for nonzero quaternions $p$ and $q$.

    Your proof should verify both the left and right inverse identities.

  7. Numerical product inverse.

    Let

    $\displaystyle p = 1+2\mathbf i-\mathbf j+\mathbf k $

    and

    $\displaystyle q = 2-\mathbf i+\mathbf j+3\mathbf k. $

    Compute

    $\displaystyle pq, \qquad (pq)^{-1}, \qquad q^{-1}p^{-1}. $

    Verify numerically that the last two quantities are equal.

  8. Why $p^{-1}q^{-1}$ is generally wrong.

    Using the quaternions from Exercise 7, compute

    $\displaystyle p^{-1}q^{-1}. $

    Compare it with

    $\displaystyle (pq)^{-1}. $

    Explain the discrepancy.

  9. Solve a left multiplication equation.

    Let

    $\displaystyle p x=r, $

    where

    $\displaystyle p=1+\mathbf i $

    and

    $\displaystyle r=2+\mathbf j. $

    Solve for $x$ by multiplying by the appropriate inverse on the correct side.

    Verify your answer by direct substitution.

  10. Solve a right multiplication equation.

    Let

    $\displaystyle x p=r, $

    with the same

    $\displaystyle p=1+\mathbf i $

    and

    $\displaystyle r=2+\mathbf j. $

    Solve for $x$.

    Compare the result with Exercise 9 and explain why the two answers differ.

  11. Inverse of a power.

    Prove for every positive integer $n$ that

    $\displaystyle (q^n)^{-1} = (q^{-1})^n.$ (11)

    Does factor reversal create any complication when all factors are the same quaternion?

  12. Inverse of a real scalar multiple.

    Let $\lambda\neq0$ be real and $q\neq0$.

    Prove

    $\displaystyle (\lambda q)^{-1} = \frac{1}{\lambda} q^{-1}.$ (12)

    Then verify the identity with

    $\displaystyle \lambda=-3, \qquad q=1+\mathbf j. $
  13. Passive frame map reversal.

    Frame $B$ is obtained from frame $A$ by a positive $90^\circ$ frame rotation about $+\widehat{\mathbf z}$.

    PhysicsLibrary uses

    $\displaystyle {}^{B}q_A = \frac{1-\mathbf k}{\sqrt2}. $

    Compute

    $\displaystyle ({}^{B}q_A)^{-1} $

    and identify it as a frame labeled quaternion.

  14. Undo a passive coordinate transformation.

    Suppose

    $\displaystyle {}^{B}v = {}^{B}q_A \,{}^{A}v \,({}^{B}q_A)^*$ (13)

    with a unit attitude quaternion.

    Use the inverse to solve for ${}^{A}v$.

    Write the reverse transformation using both inverse notation and conjugate notation.

  15. Inverse of $q$ versus inverse of $-q$.

    For nonzero $q$, prove

    $\displaystyle (-q)^{-1} = -q^{-1}.$ (14)

    If $q$ is a unit attitude quaternion, explain why $q^{-1}$ and $-q^{-1}$ still represent the same reverse physical orientation.

  16. Software diagnostic: conjugate is not always the inverse.

    A software routine defines

    $\displaystyle \operatorname{inv}(q)=q^* $

    for every quaternion.

    Test the routine on

    $\displaystyle q = 2+\mathbf i. $

    Compute the routine's result, the true inverse, and

    $\displaystyle q q^*. $

    Under what condition is the software routine correct?

Solutions

Solution 1: direct inverse calculation

For

$\displaystyle q = 2-\mathbf i+2\mathbf j+2\mathbf k, $

the conjugate is

$\displaystyle q^* = 2+\mathbf i-2\mathbf j-2\mathbf k.$ (15)

The squared norm is

\begin{equation*} \begin{aligned} \lVert q\rVert^2 &= 2^2+(-1)^2+2^2+2^2\ &= 4+1+4+4\ &= 13. \end{aligned}\end{equation*}

Therefore

$\displaystyle q^{-1} = \frac{ 2+\mathbf i-2\mathbf j-2\mathbf k }{ 13 }.$ (16)

Solution 2: verify both inverse identities

From Exercise 1,

$\displaystyle q^{-1} = \frac{q^*}{13}. $

Therefore

$\displaystyle q q^{-1} = q\frac{q^*}{13} = \frac{q q^*}{13}. $

Since

$\displaystyle q q^*=13, $

we obtain

$\displaystyle q q^{-1}=1.$ (17)

Likewise,

$\displaystyle q^{-1}q = \frac{q^*q}{13}. $

Because

$\displaystyle q^*q=13, $

we obtain

$\displaystyle q^{-1}q=1.$ (18)

Thus the same quaternion is both the left and right multiplicative inverse.

Solution 3: unit quaternion simplification

The quaternion is

$\displaystyle q = \frac12 (1-\mathbf i-\mathbf j-\mathbf k). $

Its squared norm is

$\displaystyle \lVert q\rVert^2 = \frac14 (1+1+1+1) = 1. $

Thus

$\displaystyle \lVert q\rVert=1.$ (19)

The conjugate is

$\displaystyle q^* = \frac12 (1+\mathbf i+\mathbf j+\mathbf k). $

Since the norm squared is one,

$\displaystyle q^{-1} = \frac{q^*}{1}. $

Therefore

$\displaystyle q^{-1} = q^* = \frac12 (1+\mathbf i+\mathbf j+\mathbf k).$ (20)

Solution 4: real and pure quaternion inverses

For

$\displaystyle r=-4, $

the conjugate is also $-4$, and

$\displaystyle \lVert r\rVert^2=16. $

Therefore

$\displaystyle r^{-1} = -\frac14.$ (21)

Now consider

$\displaystyle v = 2\mathbf i-\mathbf j+2\mathbf k. $

Because $v$ is pure,

$\displaystyle v^*=-v. $

Its squared norm is

$\displaystyle \lVert v\rVert^2 = 4+1+4 = 9. $

Therefore

$\displaystyle v^{-1} = \frac{v^*}{\lVert v\rVert^2} = -\frac{v}{9}.$ (22)

Explicitly,

$\displaystyle v^{-1} = -\frac29\mathbf i + \frac19\mathbf j - \frac29\mathbf k.$ (23)

Solution 5: why the zero quaternion has no inverse

An inverse $q^{-1}$ would have to satisfy

$\displaystyle q q^{-1}=1. $

If

$\displaystyle q=0, $

then for every quaternion $x$,

$\displaystyle 0x=0. $

Therefore no quaternion can satisfy

$\displaystyle 0x=1. $

The formula

$\displaystyle q^{-1} = \frac{q^*}{\lVert q\rVert^2} $

shows the same obstruction algebraically. For $q=0$,

$\displaystyle \lVert q\rVert^2=0, $

so the expression would require division by zero.

Thus

$\displaystyle 0^{-1} \quad\hbox{does not exist}.$ (24)

Solution 6: inverse of a product

Consider

$\displaystyle q^{-1}p^{-1}. $

Multiply it on the right of $pq$:

\begin{equation*} \begin{aligned} (pq)(q^{-1}p^{-1}) &= p(qq^{-1})p^{-1}\ &= p(1)p^{-1}\ &= pp^{-1}\ &= 1. \end{aligned}\end{equation*}

Thus $q^{-1}p^{-1}$ is a right inverse of $pq$.

Now multiply it on the left:

\begin{equation*} \begin{aligned} (q^{-1}p^{-1})(pq) &= q^{-1}(p^{-1}p)q\ &= q^{-1}(1)q\ &= q^{-1}q\ &= 1. \end{aligned}\end{equation*}

Thus it is also a left inverse.

Therefore

$\displaystyle (pq)^{-1} = q^{-1}p^{-1}.$ (25)

The factor order reverses.

Solution 7: numerical product inverse

Let

$\displaystyle p = 1+2\mathbf i-\mathbf j+\mathbf k $

and

$\displaystyle q = 2-\mathbf i+\mathbf j+3\mathbf k. $

Hamilton multiplication gives

$\displaystyle pq = 2-\mathbf i-8\mathbf j+6\mathbf k.$ (26)

Its squared norm is

$\displaystyle \lVert pq\rVert^2 = 2^2+(-1)^2+(-8)^2+6^2 = 105. $

Therefore

$\displaystyle (pq)^{-1} = \frac{ 2+\mathbf i+8\mathbf j-6\mathbf k }{ 105 }.$ (27)

Now

$\displaystyle \lVert p\rVert^2 = 1+4+1+1 = 7, $

so

$\displaystyle p^{-1} = \frac{ 1-2\mathbf i+\mathbf j-\mathbf k }{ 7 }.$ (28)

Also,

$\displaystyle \lVert q\rVert^2 = 4+1+1+9 = 15, $

so

$\displaystyle q^{-1} = \frac{ 2+\mathbf i-\mathbf j-3\mathbf k }{ 15 }.$ (29)

Multiplying in the reversed order,

$\displaystyle q^{-1}p^{-1} = \frac{1}{105} (2+\mathbf i-\mathbf j-3\mathbf k) (1-2\mathbf i+\mathbf j-\mathbf k). $

The numerator product is

$\displaystyle 2+\mathbf i+8\mathbf j-6\mathbf k. $

Hence

$\displaystyle q^{-1}p^{-1} = \frac{ 2+\mathbf i+8\mathbf j-6\mathbf k }{ 105 } = (pq)^{-1}.$ (30)

Solution 8: why $p^{-1}q^{-1}$ is generally wrong

Using the inverses from Solution 7,

$\displaystyle p^{-1}q^{-1} = \frac{1}{105} (1-2\mathbf i+\mathbf j-\mathbf k) (2+\mathbf i-\mathbf j-3\mathbf k). $

The numerator product is

$\displaystyle 2-7\mathbf i-4\mathbf j-8\mathbf k. $

Therefore

$\displaystyle p^{-1}q^{-1} = \frac{ 2-7\mathbf i-4\mathbf j-8\mathbf k }{ 105 }.$ (31)

But

$\displaystyle (pq)^{-1} = \frac{ 2+\mathbf i+8\mathbf j-6\mathbf k }{ 105 }. $

They differ because quaternion multiplication is not generally commutative.

The inverse must undo the last factor first, so product inversion reverses factor order.

Solution 9: solve a left multiplication equation

We are given

$\displaystyle p x=r. $

Left multiply by $p^{-1}$:

$\displaystyle p^{-1}px = p^{-1}r. $

Thus

$\displaystyle x = p^{-1}r.$ (32)

For

$\displaystyle p=1+\mathbf i, $

the squared norm is

$\displaystyle 2, $

so

$\displaystyle p^{-1} = \frac{1-\mathbf i}{2}. $

Therefore

\begin{equation*} \begin{aligned} x &= \frac12 (1-\mathbf i)(2+\mathbf j)\ &= ... ...)\ &= \frac12 (2-2\mathbf i+\mathbf j-\mathbf k). \end{aligned}\end{equation*}

Hence

$\displaystyle x = 1-\mathbf i + \frac12\mathbf j - \frac12\mathbf k.$ (33)

Direct substitution gives

$\displaystyle (1+\mathbf i)x = 2+\mathbf j = r. $

Solution 10: solve a right multiplication equation

Now

$\displaystyle x p=r. $

Right multiply by $p^{-1}$:

$\displaystyle xpp^{-1} = rp^{-1}. $

Thus

$\displaystyle x = rp^{-1}.$ (34)

Using

$\displaystyle p^{-1} = \frac{1-\mathbf i}{2}, $

we obtain

\begin{equation*} \begin{aligned} x &= \frac12 (2+\mathbf j)(1-\mathbf i)\ &= \frac12 (2-2\mathbf i+\mathbf j-\mathbf j\mathbf i). \end{aligned}\end{equation*}

Because

$\displaystyle \mathbf j\mathbf i=-\mathbf k, $

we get

$\displaystyle x = \frac12 (2-2\mathbf i+\mathbf j+\mathbf k). $

Therefore

$\displaystyle x = 1-\mathbf i + \frac12\mathbf j + \frac12\mathbf k.$ (35)

This differs from Solution 9 in the sign of the $\mathbf k$ component.

The difference arises because left and right division are distinct operations in a noncommutative algebra.

Solution 11: inverse of a power

For

$\displaystyle q^n = \underbrace{ q q\cdots q }_{n\ \mathrm{factors}}, $

repeated application of product inversion gives

$\displaystyle (q^n)^{-1} = \underbrace{ q^{-1}q^{-1}\cdots q^{-1} }_{n\ \mathrm{factors}}. $

Hence

$\displaystyle (q^n)^{-1} = (q^{-1})^n.$ (36)

Factor reversal creates no visible change because all factors are identical.

Solution 12: inverse of a real scalar multiple

Let

$\displaystyle p=\lambda q, \qquad \lambda\neq0. $

Since $\lambda$ is real, it commutes with every quaternion.

Consider

$\displaystyle \frac{1}{\lambda}q^{-1}. $

Then

\begin{equation*} \begin{aligned} (\lambda q) \left( \frac{1}{\lambda}q^{-1} \right) &= \lambda \frac{1}{\lambda} qq^{-1}\ &= 1. \end{aligned}\end{equation*}

The product in the other order also equals one.

Therefore

$\displaystyle (\lambda q)^{-1} = \frac{1}{\lambda}q^{-1}.$ (37)

For

$\displaystyle q=1+\mathbf j, $

$\displaystyle q^{-1} = \frac{1-\mathbf j}{2}. $

With

$\displaystyle \lambda=-3, $

we obtain

$\displaystyle (-3q)^{-1} = -\frac16 (1-\mathbf j).$ (38)

Solution 13: passive frame map reversal

The forward passive map is

$\displaystyle {}^{B}q_A = \frac{1-\mathbf k}{\sqrt2}. $

It is unit, so inverse equals conjugate:

$\displaystyle ({}^{B}q_A)^{-1} = ({}^{B}q_A)^*. $

Therefore

$\displaystyle ({}^{B}q_A)^{-1} = \frac{1+\mathbf k}{\sqrt2}.$ (39)

The inverse reverses the frame map, so

$\displaystyle {}^{A}q_B = \frac{1+\mathbf k}{\sqrt2}.$ (40)

Solution 14: undo a passive coordinate transformation

We begin with

$\displaystyle {}^{B}v = {}^{B}q_A \,{}^{A}v \,({}^{B}q_A)^*. $

Let

$\displaystyle q = {}^{B}q_A. $

Because $q$ is unit,

$\displaystyle q^{-1}=q^*. $

Left multiply by $q^{-1}$ and right multiply by $(q^*)^{-1}$:

$\displaystyle {}^{A}v = q^{-1} \,{}^{B}v \,(q^*)^{-1}. $

Since

$\displaystyle (q^*)^{-1}=q, $

we obtain

$\displaystyle {}^{A}v = q^{-1} \,{}^{B}v \,q.$ (41)

Using the unit relation $q^{-1}=q^*$,

$\displaystyle {}^{A}v = q^* \,{}^{B}v \,q.$ (42)

Equivalently, with frame labels,

$\displaystyle {}^{A}v = {}^{A}q_B \,{}^{B}v \,({}^{A}q_B)^*.$ (43)

Solution 15: inverse of $q$ versus inverse of $-q$

Use

$\displaystyle (-q)^* = -q^* $

and

$\displaystyle \lVert-q\rVert^2 = \lVert q\rVert^2. $

Then

\begin{equation*} \begin{aligned} (-q)^{-1} &= \frac{ (-q)^* }{ \lVert-q\rVert^2... ...&= \frac{ -q^* }{ \lVert q\rVert^2 }\ &= -q^{-1}. \end{aligned}\end{equation*}

Therefore

$\displaystyle (-q)^{-1} = -q^{-1}.$ (44)

For unit attitude quaternions, $q^{-1}$ and $-q^{-1}$ are antipodal unit quaternions representing the same reverse physical orientation.

Solution 16: software diagnostic: conjugate is not always the inverse

The software routine returns

$\displaystyle q^* = 2-\mathbf i. $

But

$\displaystyle \lVert q\rVert^2 = 2^2+1^2 = 5. $

Therefore the true inverse is

$\displaystyle q^{-1} = \frac{ 2-\mathbf i }{ 5 }.$ (45)

The product with the conjugate is

\begin{equation*} \begin{aligned} q q^* &= (2+\mathbf i)(2-\mathbf i)\ &= 4-\mathbf i^2\ &= 5. \end{aligned}\end{equation*}

Thus

$\displaystyle q q^*=5,$ (46)

not $1$.

The routine

$\displaystyle \operatorname{inv}(q)=q^* $

is correct only when

$\displaystyle \lVert q\rVert=1.$ (47)

For general nonzero quaternions, division by the norm squared is required.

Compact review

The central inverse identities reinforced by this companion are

$\displaystyle q^{-1} = \frac{q^*}{\lVert q\rVert^2}, \qquad q\neq0,$ (48)
$\displaystyle q q^{-1} = q^{-1}q = 1,$ (49)
$\displaystyle (pq)^{-1} = q^{-1}p^{-1},$ (50)

and, for unit quaternions,

$\displaystyle q^{-1}=q^*.$ (51)

For passive PhysicsLibrary attitude quaternions,

$\displaystyle {}^{A}q_B = ({}^{B}q_A)^{-1} = ({}^{B}q_A)^*.$ (52)

Thus algebraic inversion and reversal of a unit passive frame map are the same operation.

Sources and exercise provenance

The exercises and solutions in this companion are newly written or expanded for PhysicsLibrary from the algebra developed in Quaternion Inverse.

Hamilton is the foundational source for quaternion division and reciprocals. Joly and Kelland–Tait provide classical systematic treatments of quaternion inverse operations. Sommer and coauthors provide a modern engineering discussion of unit quaternion conventions and frame transformations.

Bibliography

1
W. R. Hamilton, Elements of Quaternions, 2nd ed., edited by C. J. Joly, Longmans, Green, and Co., 1899. Public domain historical source. Internet Archive scan
2
C. J. Joly, A Manual of Quaternions, Macmillan and Co., London, 1905. Public domain historical source. Internet Archive search
3
P. Kelland and P. G. Tait, Introduction to Quaternions, with Numerous Examples, 2nd ed., Macmillan and Co., London, 1882. Public domain historical source. Internet Archive search
4
H. Sommer, I. Gilitschenski, M. Bloesch, S. Weiss, R. Siegwart, and J. Nieto, “Why and How to Avoid the Flipped Quaternion Multiplication,” Aerospace, vol. 5, no. 3, article 72, 2018. Published under CC BY 4.0. Publisher article

License

Unless otherwise noted, this PhysicsLibrary entry is intended for release under the Creative Commons Attribution ShareAlike 4.0 International license.



"example of quaternion inverse" is owned by bloftin.
(view preamble)
View style:
See Also: quaternion series overview and article guide, Notation Quaternions for Physics and Engineering: Orientation, quaternion definition and basic algebra, example of quaternion definition and basic algebra, quaternion product, example of quaternion product, quaternion conjugate, example of quaternion conjugate, quaternion norm, example of quaternion norm, quaternion inverse, Axis Angle Representation and Unit Quaternion, example of Axis Angle Representation and Unit Quaternion, rotating vectors with quaternions, example of rotating vectors with quaternions, composition of rotations and quaternion order, example of composition of rotations and quaternion order, quaternions and direction cosine matrices, example of quaternions and direction cosine matrices, quaternions and Euler angles, example of quaternions and Euler angles, quaternion kinematics and angular velocity, example of quaternion kinematics and angular velocity, relative attitude and error quaternions, example of relative attitude and error quaternions, numerical quaternion propagation and IMU attitude state integration, example of numerical quaternion propagation and IMU attitude state integration, quaternion exercises for physics and engineering

Keywords:  quaternion, inverse, reciprocal, division, unit quaternion, conjugate, norm, Hamilton product, noncommutative algebra, exercises, worked solutions

This object's parent.

Cross-references: algebraic, relation, commutes, noncommutative, operations, formula, scalar, power, identities, quaternions, quaternion multiplication, norm, quaternion inverse
There is 1 reference to this object.

This is version 2 of example of quaternion inverse, born on 2026-08-28, modified 2026-08-28.
Object id is 1118, canonical name is ExampleOfQuaternionInverse.
Accessed 21 times total.

Classification:
Physics Classification02.10.Hh (Rings and algebras)
 02.10.Ud (Linear algebra)
Pending Errata and Addenda
None.
Discussion
Style: Expand: Order:

No messages.

Interact
rate | post | correct | update request | add example | add (any)