# What is the general equation equation for rotated ellipsoid?

I have general equation for ellipsoid not in center:
$$\frac{(x-x_0)^2}{a^2}+\frac{(y-y_0)^2}{b^2}+\frac{(z-z_0)^2}{c^2}=1.$$
What is the equation when it’s rotated based on $\alpha$(over $x$ axis), $\beta$(over $y$ axis) and $\gamma$(over $z$ axis)?

#### Solutions Collecting From Web of "What is the general equation equation for rotated ellipsoid?"

The parameters of the rotation you describe are
Tait-Bryan angles.
Exactly what rotation they represent depends on several things:
the sequence in which you apply the rotations, whether they are
intrinsic (body-axis) or extrinsic (fixed-axis) rotations,
whether you have a “right-handed” or “left-handed” set of $x,y,z$ axes,
and whether a positive rotation angle represents a
“right-handed” or “left-handed” rotation around each axis.

A typical setup might be as follows: using a right-handed coordinate system
and using a positive angle to represent any right-handed rotation,
perform intrinsic rotations first around the $z$-axis through an angle $\gamma$,
then around the (rotated) $y$-axis of the body through an angle $\beta$, and
finally around the (twice-rotated) $x$-axis of the body through an angle $\alpha$.

Since you also want the center of the body to be offset from the origin of
coordinates, after performing the rotations we will translate the entire
body by the same translation that takes $(0,0,0)$ to $(x_0,y_0,z_0)$.

If $(x’,y’,z’)$ are the coordinates of a point on the body prior to rotation,
and $(x,y,z)$ are the coordinates of the image of that point after rotation
and translation, then
$$\begin{pmatrix} x \\ y \\ z \end{pmatrix} = R_z(\gamma)R_y(\beta)R_x(\alpha) \begin{pmatrix} x’ \\ y’ \\ z’ \end{pmatrix} + \begin{pmatrix} x_0 \\ y_0 \\ z_0 \end{pmatrix}$$
where
$$R_x(\alpha) = \begin{pmatrix} 1 & 0 & 0 \\ 0 & \cos\alpha & -\sin\alpha \\ 0 & \sin\alpha & \cos\alpha \end{pmatrix}, \quad R_y(\beta) = \begin{pmatrix} \cos\beta & 0 & \sin\beta \\ 0 & 1 & 0 \\ -\sin\beta & 0 & \cos\beta \end{pmatrix}, \quad\text{and}$$
$$R_z(\gamma) = \begin{pmatrix} \cos\gamma & -\sin\gamma & 0\\ \sin\gamma & \cos\gamma & 0 \\ 0 & 0 & 1 \end{pmatrix}.$$
(Yes, that means the rotation matrix for angle $\alpha$ around the $x$-axis
is applied first. The use of intrinsic rotations rather than extrinsic
rotations causes the sequence of matrix multiplications to be reversed.)

If the original coordinates of all points on a body satisfy the equation
$f(x’,y’,z’) = 0$,
then in order to find an equation satisfied by the image of that body
after the rotation and translation described above,
we first write
$$\begin{pmatrix} x’ \\ y’ \\ z’ \end{pmatrix} = R_x(-\alpha) R_y(-\beta) R_z(-\gamma) \begin{pmatrix} x – x_0 \\ y – y_0 \\ z – z_0 \end{pmatrix}.$$
After fully working out the matrix multiplications on the right-hand side,
the result is a column vector in which each element is some function
of $x$, $y$, $z$, $x_0$, $y_0$, $z_0$, $\alpha$, $\beta$, and $\gamma$.
That is, we now have each of the coordinates $x’$, $y’$, and $z’$
of a point of the the unrotated, untranslated object
(on the left-hand side of the vector equation)
expressed in terms of the coordinates $x$, $y$, and $z$
of the rotated and translated image of the object,
along with parameters of the rotation and translation.
We can use these equations to substitute for $x’$, $y’$, and $z’$
in the equation $f(x’,y’,z’) = 0$,
resulting in a new equation, $g(x,y,z) = 0$.

This is assuming that you perform the rotation and translation exactly
as described in the paragraph about “a typical setup”.
Depending on exactly how you actually perform your rotation and translation,
you may have to change the order in which the matrix/vector operations are performed, or you may have to reverse the signs of some angles in the matrices, or both.

Then if you want an equation that determines a rotated and translated
ellipsoid, develop the equations for $x’$, $y’$, and $z’$ in terms of $x$, $y$, $z$, and the parameters of the rotation and translation, according to the
formulas above or whatever variation of them is appropriate to your particular
rotation and translation,
and use these equations to substitute for $x’$, $y’$, and $z’$ in
$$f(x’,y’,z’) = \frac{x’^2}{a^2} + \frac{y’^2}{b^2} + \frac{z’^2}{c^2} – 1 = 0.$$
The resulting equation in $x$, $y$, and $z$ is the equation of
the rotated, translated ellipsoid.

You could further “simplify” the equation by multiplying out the squared
expressions and recombining terms into a more standard polynomial form
with terms in $x^2$, $y^2$, $z^2$, $xy$, $yz$, $xz$, $x$, $y$, $z$, and
a constant, but I think that would obscure the meaning of the equation
(namely, that it describes an ellipsoid) and might not be desirable.

Hint:

An ellipsoid with center at a point $\mathbf{v}$ has general equation:
$$(\mathbf{x}-\mathbf{v})^TA(\mathbf{x}-\mathbf{v})=1$$
where $A$ is a positive defined matrix whose eigenspaces are the proncipal axis of the ellipsoid and whose eigenvectors ar the squared inverses of the semiaxis (see here).
This means that we can write $A$ as a product $QDQ^T$ where $D$ is a diagonal matrix with the squared inverses of the semiaxis as diagonal elements, and $Q$ is a simmetric matrix whose columns represents the axis of the ellipsoid.