# Decomposing the Transformation matrix and the order of operation?

**URL:** <https://discourse.slicer.org/t/decomposing-the-transformation-matrix-and-the-order-of-operation/18904>\
**Category:** Support\
**Created:** [July 24, 2021, 9:29am UTC](https://discourse.slicer.org/t/decomposing-the-transformation-matrix-and-the-order-of-operation/18904 "2021-07-24T09:29:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amit\_1993](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/amit_1993/32/9480_2.png) [@Amit\_1993](https://discourse.slicer.org/u/Amit_1993)\
**Post date:** [July 24, 2021, 9:29am UTC](https://discourse.slicer.org/t/decomposing-the-transformation-matrix-and-the-order-of-operation/18904/1 "2021-07-24T09:29:32Z")

</div>

Hi all!

In 3D slicer Image Registration Operation :

I want to decompose the individual Transformation operation as a product of Translation Matrix, Scaling Matrix, and Rotation Matrix(if used). So, I need to know the order of multiplication and elements of these matrices. Finally, I wanted to take a general equation out of these matrices which tell the order of operation and element relationship (if any, between the elements of each matrix)

Can anyone give some solution related to this? Thanks!

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [July 24, 2021, 12:27pm UTC](https://discourse.slicer.org/t/decomposing-the-transformation-matrix-and-the-order-of-operation/18904/2 "2021-07-24T12:27:47Z")

</div>

Scaling matrix is a diagonal matrix that contains the column norms of the transformation matrix.  
Rotation matrix is the transformation matrix with translation removed (the 4th column set to `[0,0,0,1]`) and the columns normalized.  
Translation matrix is the transformation matrix with the top-left 3x3 submatrix set to identity matrix.

Order of rotation and scaling does not matter (rotate then scale = scale then rotate). You need to translate after you rotated&scaled.
