EulerMatrix[{α,β,γ}]
gives the Euler 3D rotation matrix formed by rotating by α around the current
axis, then by β around the current
axis, and then by γ around the current
axis.
EulerMatrix[{α,β,γ},{a,b,c}]
gives the Euler 3D rotation matrix corresponding, first rotating by α around the current a axis, then by β around the current b axis, and finally by γ around the current c axis.
EulerMatrix
EulerMatrix[{α,β,γ}]
gives the Euler 3D rotation matrix formed by rotating by α around the current
axis, then by β around the current
axis, and then by γ around the current
axis.
EulerMatrix[{α,β,γ},{a,b,c}]
gives the Euler 3D rotation matrix corresponding, first rotating by α around the current a axis, then by β around the current b axis, and finally by γ around the current c axis.
Details and Options
- EulerMatrix is also known as Euler rotation matrix or Euler rotation, and the angles α, β, and γ are often referred to as Euler angles.
- EulerMatrix is typically used to specify a rotation as a sequence of basic rotations around coordinate axes where each subsequent rotation is referring to the current or intrinsic coordinate frame.
- EulerMatrix[{α,β,γ}] is equivalent to EulerMatrix[{α,β,γ},{3,2,3}].
- The default z-y-z rotation EulerMatrix[{α,β,γ},{3,2,3}]:
- EulerMatrix[{α,β,γ},{a,b,c}] is equivalent to
, where Rα,a=RotationMatrix[α,UnitVector[3,a]] etc. » - The x-y-z rotation EulerMatrix[{α,β,γ},{1,2,3}]:
- The rotation axes a, b, and c can be any integer 1, 2, or 3, but there are only 12 combinations that are general enough to be able to specify any 3D rotation.
- Rotations with the first and last axis repeated:
-
{3,2,3} z-y-z rotation (default) 
{3,1,3} z-x-z rotation 
{2,3,2} y-z-y rotation 
{2,1,2} y-x-y rotation 
{1,3,1} x-z-x rotation 
{1,2,1} x-y-x rotation 
- Rotations with all three axes different:
-
{1,2,3} x-y-z rotation 
{1,3,2} x-z-y rotation 
{2,1,3} y-x-z rotation 
{2,3,1} y-z-x rotation 
{3,1,2} z-x-y rotation 
{3,2,1} z-y-x rotation 
- Rotations with subsequent axes repeated still produce a rotation matrix but cannot be inverted uniquely using EulerAngles.
- EulerMatrix supports the option TargetStructure, which specifies the structure of the returned matrix. Possible settings for TargetStructure include:
-
Automatic automatically choose the representation returned "Dense" represent the matrix as a dense matrix "Orthogonal" represent the matrix as an orthogonal matrix "Unitary" represent the matrix as a unitary matrix - EulerMatrix[…,TargetStructureAutomatic] is equivalent to EulerMatrix[…,TargetStructure"Dense"].
Examples
open all close allBasic Examples (2)
Scope (6)
Give the standard z-y-z Euler rotation matrix with
,
, and
:
(m = EulerMatrix[{(3π/4), (π/3), (π/3)}])//MatrixFormv1 = {1, 0, 0};
v2 = m.v1Visualize the rotated vector (red):
Graphics3D[{Arrow[{{0, 0, 0}, v1}], StandardRed, Arrow[{{0, 0, 0}, v2}]}]Give an x-y-x Euler rotation matrix by specifying the second argument:
m = EulerMatrix[{(3π/4), (π/3), (π/3.)}, {1, 2, 1}]Rotate and visualize the vector {1,0,0}:
v1 = {1, 0, 0}; v2 = m.v1;Graphics3D[{Arrow[{{0, 0, 0}, v1}], StandardRed, Arrow[{{0, 0, 0}, v2}]}]Give an x-y-z Euler rotation matrix:
m = EulerMatrix[{(3π/4), (π/3), (π/3.)}, {1, 2, 3}]Rotate and visualize the vector {1,0,0}:
v1 = {1, 0, 0}; v2 = m.v1;Graphics3D[{Arrow[{{0, 0, 0}, v1}], StandardRed, Arrow[{{0, 0, 0}, v2}]}]Rotate primitives in 3D graphics using GeometricTransformation:
gr = {Cuboid[], AbsolutePointSize[10], Opacity[1], {Magenta, Point[{0, 0, 0}]}, {Green, Point[{1, 1, 1}]}};Graphics3D[{{Opacity[.35], Blue, gr}, GeometricTransformation[{Opacity[.85], Red, gr}, EulerMatrix[{(π/2), (π/4), (3π/4)}]]}, Boxed -> False]Rotate a region using TransformedRegion:
s1 = [image];m = EulerMatrix[{Pi / 4, -Pi / 2, -Pi / 4}];s2 = TransformedRegion[s1, AffineTransform@m];{s1, s2}Rotate a 3D image using ImageTransformation:
r1 = ExampleData[{"TestImage3D", "Orbits"}];m = EulerMatrix[{Pi / 4, -Pi / 4, -Pi / 4}];r2 = ImageTransformation[r1, InverseFunction@AffineTransform@m, PlotRange -> All];{r1, r2}Options (1)
TargetStructure (1)
Return the Euler rotation matrix as a dense matrix:
EulerMatrix[{(3π/4), (π/3), (π/3)}, TargetStructure -> "Dense"]Return the Euler rotation matrix as an orthogonal matrix:
EulerMatrix[{(3π/4), (π/3), (π/3)}, TargetStructure -> "Orthogonal"]Return the Euler rotation matrix as a unitary matrix:
EulerMatrix[{(3π/4), (π/3), (π/3)}, TargetStructure -> "Unitary"]Applications (6)
Illustrations (1)
Build a function that illustrates Euler rotations, showing the axis that is being rotated around:
$scene = First@[image];EulerRotationIllustration[{α_, β_, γ_}, {a_, b_, c_}] :=
Map[Graphics3D[GeometricTransformation[$scene, #], PlotRange -> 1.2, ImageSize -> 110, BoxStyle -> LightGray]&,
{EulerMatrix[{0, 0, 0}, {a, b, c}], EulerMatrix[{α, 0, 0}, {a, b, c}], EulerMatrix[{α, β, 0}, {a, b, c}], EulerMatrix[{α, β, γ}, {a, b, c}]}
]Here are all six of the a-b-a axes rotations. First is the standard z-y-z Euler rotation:
EulerRotationIllustration[{Pi / 2, Pi / 2, Pi / 2}, {3, 2, 3}]EulerRotationIllustration[{Pi / 2, Pi / 2, Pi / 2}, {1, 2, 1}]EulerRotationIllustration[{Pi / 2, Pi / 2, Pi / 2}, {1, 3, 1}]EulerRotationIllustration[{Pi / 2, Pi / 2, Pi / 2}, {2, 1, 2}]EulerRotationIllustration[{Pi / 2, Pi / 2, Pi / 2}, {2, 3, 2}]EulerRotationIllustration[{Pi / 2, Pi / 2, Pi / 2}, {3, 1, 3}]Then there are the six a-b-c axes rotations. First is the x-y-z Euler rotation:
EulerRotationIllustration[{Pi / 2, Pi / 2, Pi / 2}, {1, 2, 3}]EulerRotationIllustration[{Pi / 2, Pi / 2, Pi / 2}, {1, 3, 2}]EulerRotationIllustration[{Pi / 2, Pi / 2, Pi / 2}, {2, 1, 3}]EulerRotationIllustration[{Pi / 2, Pi / 2, Pi / 2}, {2, 3, 1}]EulerRotationIllustration[{Pi / 2, Pi / 2, Pi / 2}, {3, 1, 2}]EulerRotationIllustration[{Pi / 2, Pi / 2, Pi / 2}, {3, 2, 1}]Gimbals (5)
A gimbal is a system of pivoted rings that allows an object to orient itself in an arbitrary direction. These are used in various navigation and imaging applications:
ring3 = {StandardRed, CapForm -> None, Tube[{{-.1, 0, 0}, {.1, 0, 0}}, 3], Line[{{{0, 0, 4}, {0, 0, 3}}, -{{0, 0, 4}, {0, 0, 3}}}]};
ring2 = {StandardBlue, CapForm -> None, Tube[{{-.1, 0, 0}, {.1, 0, 0}}, 2], Line[{{{0, 3, 0}, {0, 2, 0}}, -{{0, 3, 0}, {0, 2, 0}}}]};
ring1 = {CapForm -> None, Arrow[{{-1, 0, 0}, {1, 0, 0}}], StandardGreen, Line[{{{0, 0, 1}, {0, 0, 2}}, -{{0, 0, 1}, {0, 0, 2}}}], Tube[{{-.1, 0, 0}, {.1, 0, 0}}, 1]};The orientation of the object within a gimbal can be modeled using EulerMatrix with the angles of the rings' rotations, from the outermost to the innermost rings. Note that an a-b-a axis system is used:
gimbal[{α_, β_, γ_}] :=
Graphics3D[{Thick, GeometricTransformation[ring3, EulerMatrix[{α, 0, 0}]], GeometricTransformation[ring2, EulerMatrix[{α, β, 0}]], GeometricTransformation[ring1, EulerMatrix[{α, β, γ}]]},
ViewPoint -> {1.3, -2.4, 2.}, PlotRange -> 3.5, PlotLabel -> NumberForm[MatrixForm[{{α, β, γ}}], 2]]Manipulate[gimbal[{α, β, γ}], {{α, 0}, 0, 2Pi, Pi / 32}, {{β, 0}, 0, 2Pi, Pi / 32}, {{γ, 0}, 0, 2Pi, Pi / 32}, SaveDefinitions -> True]A gimbal with a-b-c axis rotations models a gimbal system with an initial state where all rings' axes are perpendicular to each other:
ring3 = {StandardRed, CapForm -> None, Tube[{{-.1, 0, 0}, {.1, 0, 0}}, 3], Line[{{{0, 0, 4}, {0, 0, 3}}, -{{0, 0, 4}, {0, 0, 3}}}]};
ring2 = {StandardBlue, CapForm -> None, Tube[{{0, 0, -.1}, {0, 0, .1}}, 2], Line[{{{0, 3, 0}, {0, 2, 0}}, -{{0, 3, 0}, {0, 2, 0}}}]};
ring1 = {CapForm -> None, Arrow[{{0, -1, 0}, {0, 1, 0}}], StandardGreen, Tube[{{0, -.1, 0}, {0, .1, 0}}, 1], Line[{{{1, 0, 0}, {2, 0, 0}}, -{{1, 0, 0}, {2, 0, 0}}}]};This uses the z-y-x Euler rotation:
gimbal[{α_, β_, γ_}] :=
Graphics3D[{Thick, GeometricTransformation[ring3, EulerMatrix[{α, 0, 0}, {3, 2, 1}]], GeometricTransformation[ring2, EulerMatrix[{α, β, 0}, {3, 2, 1}]], GeometricTransformation[ring1, EulerMatrix[{α, β, γ}, {3, 2, 1}]]},
ViewPoint -> {1.3, -2.4, 2.}, PlotRange -> 3.5, PlotLabel -> NumberForm[MatrixForm[{{α, β, γ}}], 2]]Manipulate[gimbal[{α, β, γ}], {{α, 0}, 0, 2Pi, Pi / 32}, {{β, 0}, 0, 2Pi, Pi / 32}, {{γ, 0}, 0, 2Pi, Pi / 32}, SaveDefinitions -> True]A rotation system may enter gimbal lock, a situation where a certain angle value reduces the system's degrees of freedom. The normal, non-locked case produces the following:
(m1 = EulerMatrix[{α, β, γ}] /. {β -> π / 3})//MatrixFormThe vector {1,1,0} can be rotated to an arbitrary point on a surface:
ParametricPlot3D[m1.{1, 1, 0}, {α, 0, 2π}, {γ, 0, 2π}]In the locked case, only the difference
can affect the rotation:
(m2 = EulerMatrix[{α, β, γ}] /. {β -> Pi})//TrigReduce//MatrixFormNow the vector {1,1,0} can only be rotated to a point on a curve:
ParametricPlot3D[m2.{1, 1, 0}, {α, 0, 2π}, {γ, 0, 2π}, MeshStyle -> LightDarkSwitched[GrayLevel[0]]]When axes
, gimbal lock will occur when
. Here is an example x-y-x rotation:
axes = {1, 2, 1};The non-locked m1 and locked m2 cases:
m1 = EulerMatrix[{α, β, γ}, axes] /. {β -> Pi / 2};
m2 = EulerMatrix[{α, β, γ}, axes] /. {β -> Pi};{ParametricPlot3D[m1.{1, 1, 1}, {α, 0, 2π}, {γ, 0, 2π}], ParametricPlot3D[m2.{1, 1, 1}, {α, 0, 2π}, {γ, 0, 2π}, MeshStyle -> LightDarkSwitched[GrayLevel[0]]]}Unlocked m1 and locked m2 cases for z-y-z rotation:
axes = {3, 2, 3};m1 = EulerMatrix[{α, β, γ}, axes] /. {β -> Pi / 3};
m2 = EulerMatrix[{α, β, γ}, axes] /. {β -> Pi};{ParametricPlot3D[m1.{1, 1, 1}, {α, 0, 2π}, {γ, 0, 2π}], ParametricPlot3D[m2.{1, 1, 1}, {α, 0, 2π}, {γ, 0, 2π}, MeshStyle -> LightDarkSwitched[GrayLevel[0]]]}And when axes are all different
, gimbal lock will occur when
. Here is an example x-y-z rotation:
axes = {1, 2, 3};The locked m1 and unlocked m2 cases:
m1 = EulerMatrix[{α, β, γ}, axes] /. {β -> Pi / 2};m2 = EulerMatrix[{α, β, γ}, axes] /. {β -> Pi};{ParametricPlot3D[m1.{1, 1, 1}, {α, 0, 2π}, {γ, 0, 2π}, MeshStyle -> LightDarkSwitched[GrayLevel[0]]],
ParametricPlot3D[m2.{1, 1, 1}, {α, 0, 2π}, {γ, 0, 2π}]}Locked m1 and unlocked m2 cases for y-x-z rotation:
axes = {2, 1, 3};m1 = EulerMatrix[{α, β, γ}, axes] /. {β -> Pi / 2};
m2 = EulerMatrix[{α, β, γ}, axes] /. {β -> Pi / 3};{ParametricPlot3D[m1.{1, 1, 1}, {α, 0, 2π}, {γ, 0, 2π}, MeshStyle -> LightDarkSwitched[GrayLevel[0]]], ParametricPlot3D[m2.{1, 1, 1}, {α, 0, 2π}, {γ, 0, 2π}]}Properties & Relations (11)
EulerMatrix corresponds to three rotations:
rα = RotationMatrix[α, {0, 0, 1}];
rβ = RotationMatrix[β, {0, 1, 0}];
rγ = RotationMatrix[γ, {0, 0, 1}];Simplify[rα.rβ.rγ == EulerMatrix[{α, β, γ}]]With general ordering of rotation axes:
eulerMatrix[{α_, β_, γ_}, {i_, j_, k_}] :=
RotationMatrix[α, UnitVector[3, i]].RotationMatrix[β, UnitVector[3, j]].RotationMatrix[γ, UnitVector[3, k]];Simplify[eulerMatrix[{α, β, γ}, {1, 2, 3}] == EulerMatrix[{α, β, γ}, {1, 2, 3}]]Use EulerAngles to return angles that produce the same rotation matrix:
m1 = EulerMatrix[{π / 3, π / 2, π / 4}];m2 = EulerMatrix[EulerAngles[m1]];Simplify[m1 - m2]The angles need not be the same:
a1 = {π / 2, π, π / 3};
m1 = EulerMatrix[a1];a2 = EulerAngles[m1]However, both sets of angles produce the same rotation matrix:
EulerMatrix[a1] == EulerMatrix[a2]Use RollPitchYawMatrix for rotations wrt the global coordinate frame in each step:
Graphics3D[GeometricTransformation[Cuboid[], RollPitchYawMatrix[{π / 2, π / 2, π / 2}, {1, 2, 3}]], PlotRange -> 1]EulerMatrix rotates wrt the current coordinate frame in each step:
Graphics3D[GeometricTransformation[Cuboid[], EulerMatrix[{π / 2, π / 2, π / 2}, {1, 2, 3}]], PlotRange -> 1]If two subsequent rotation axes are identical, i.e.
or
, the system has two degrees of freedom, such as when performing an x-y-y rotation:
axes = {1, 2, 2};
m = EulerMatrix[{α, β, γ}, axes] /. {β -> #}& /@ Range[0, 3Pi / 2, Pi / 2];ParametricPlot3D[#.{1, 1, 1}, {α, 0, 2π}, {γ, 0, 2π}]& /@ mIf all rotation axes are identical, i.e.
, the system has only one degree of freedom, such as when performing an x-x-x rotation:
axes = {1, 1, 1};
m = EulerMatrix[{α, β, γ}, axes] /. {β -> #}& /@ Range[0, 3Pi / 2, Pi / 2];ParametricPlot3D[#.{1, 1, 1}, {α, 0, 2π}, {γ, 0, 2π}]& /@ mEulerMatrix[{α,β,γ},{a,b,c}] is the same as RollPitchYawMatrix[{γ,β,α},{c,b,a}]:
EulerMatrix[{α, β, γ}, {1, 2, 3}] == RollPitchYawMatrix[{γ, β, α}, {3, 2, 1}]EulerMatrix only applies in
:
EulerMatrix[{Pi / 4, 0, 0}].{1, 0, 0}For general dimension, use RotationMatrix:
RotationMatrix[Pi / 4].{1, 0}RotationMatrix[Pi / 4, {{1, 0, 0, 0}, {0, 1, 0, 0}}].{1, 0, 0, 0}EulerMatrix parametrizes any rotation in terms of three axis-oriented rotations:
v = {1, 0, 0};EulerMatrix[{Pi / 4, -Pi / 4, 0}].vFor rotations around a general axis, use RotationMatrix:
RotationMatrix[Pi / 2, {1, 0, 1}].vEulerMatrix is an orthogonal matrix with determinant 1:
m = EulerMatrix[{α, β, γ}];OrthogonalMatrixQ[m]Det[m]//SimplifyThe inverse of an EulerMatrix is its transpose:
m = EulerMatrix[{α, β, γ}];Simplify[Transpose[m] == Inverse[m]]The inverse of EulerMatrix[{α,β,γ}] is EulerMatrix[{-γ,-β,-α}]:
Simplify[Inverse[EulerMatrix[{α, β, γ}]] == EulerMatrix[{-γ, -β, -α}]]The inverse of EulerMatrix[{α,β,γ},{a,b,c}] is EulerMatrix[{-γ,-β,-α},{c,b,a}]:
Simplify[Inverse[EulerMatrix[{α, β, γ}, {1, 2, 3}]] == EulerMatrix[{-γ, -β, -α}, {3, 2, 1}]]Possible Issues (1)
EulerMatrix allows equal consecutive axes, and this generates a rotation matrix:
m = EulerMatrix[{Pi, Pi / 2, Pi / 8}, {1, 1, 2}]{OrthogonalMatrixQ[m], Det[m]}//SimplifyHowever, EulerAngles requires consecutive axes to be distinct:
EulerAngles[m, {1, 1, 2}]This is because with consecutive axes equal, some rotation matrices cannot be represented:
m1 = EulerMatrix[{Pi / 3, 0, 0}, {3, 2, 1}]m2 = EulerMatrix[{α, β, γ}, {1, 1, 2}]FindInstance[And@@Thread[m1 == m2], {α, β, γ}]Neat Examples (1)
Use GeometricTransformation to visualize the rotation of a sphere by a range of angles:
Graphics3D[GeometricTransformation[{Hue[# / Pi], Sphere[{5, 0, 0}, 1]}, EulerMatrix[{#, Pi / 2, #}]]& /@ Range[0, 2Pi, Pi / 16]]Graphics3D[GeometricTransformation[{Hue[# / 4Pi], Sphere[{5, 0, 0}, 1]}, EulerMatrix[{#, Pi / 4, # * 4}]]& /@ Range[0, 2Pi, Pi / 64]]See Also
EulerAngles RollPitchYawMatrix RollPitchYawAngles RotationMatrix RotationTransform OrthogonalMatrix UnitaryMatrix AnglePath3D
Function Repository: WignerMatrix
Related Guides
Text
Wolfram Research (2015), EulerMatrix, Wolfram Language function, https://reference.wolfram.com/language/ref/EulerMatrix.html (updated 2024).
CMS
Wolfram Language. 2015. "EulerMatrix." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2024. https://reference.wolfram.com/language/ref/EulerMatrix.html.
APA
Wolfram Language. (2015). EulerMatrix. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/EulerMatrix.html
BibTeX
@misc{reference.wolfram_2026_eulermatrix, author="Wolfram Research", title="{EulerMatrix}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/EulerMatrix.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_eulermatrix, organization={Wolfram Research}, title={EulerMatrix}, year={2024}, url={https://reference.wolfram.com/language/ref/EulerMatrix.html}, note=[Accessed: 13-June-2026]}