Linear Algebra • 3D Affine Transformations

3D Scaling Matrix Generator

Generate standard 3×3 linear scaling matrices and 4×4 homogeneous affine transformation matrices in real time. Visualize 3D cuboid deformations inside an interactive spatial viewport, inspect volume scaling determinants, scale about custom pivot centers, and export code directly to Three.js, CSS 3D, Python, and GLSL.

Reviewed by Sanjay Samanta & Academic Review Board Last updated: September 2026 Volume Invariants & GL(3, ℝ) Verified
3D Scaling Matrix Generator S(s_x, s_y, s_z) Diagonal Group GL(3, ℝ) Volume Scaled: ×2.40
Presets:
Scale Factors Along Axes
X-Axis Scale (s_x)
Y-Axis Scale (s_y)
Z-Axis Scale (s_z)
Matrix Dimension:
Generated 3×3 Scaling Matrix S Diagonal Operator
Determinant det(S) 2.4000 Volume Scaling Factor
Orientation Preserved (+) Right-Handed Rule
Transform 3D Coordinate Point P = (x, y, z)
Transformed Coordinates P' = S · P:
(2.000, 1.500, 0.800)
Developer Code Exports
mesh.scale.set(2.0, 1.5, 0.8);
Interactive 3D Spatial Viewport
Unit Cube (Vol=1) Scaled Cuboid
Click & Drag to Orbit 3D • Scroll to Zoom
Physical 3D Volume & Dimension Metrics V' = |s_x · s_y · s_z| · V_0
Scaled Width (X) 2.00 units
Scaled Height (Y) 1.50 units
Scaled Depth (Z) 0.80 units
Direct Answer & Overview
Verified Educational Guide

How to Calculate 3D Scaling Transformation Matrices

A 3D scaling matrix resizes an object or vector along the X, Y, and Z Cartesian axes. In linear algebra, the standard 3×3 matrix places horizontal scale factor sx, vertical scale factor sy, and depth scale factor sz along the main diagonal, with zeros elsewhere. Coordinates map as x' = sx·x, y' = sy·y, and z' = sz·z. The determinant det(S) = sx·sy·sz represents the exact 3D volume scaling factor.

3D Scaling Transformation Formula Diagonal Tensor • Volume Magnification
Standard Equation
ƒ(x,y,z)
Q.E.D.
S(sx,sy,sz)=(sx000sy000sz)(x′y′z′)=(sx⋅xsy⋅ysz⋅z)\mathbf{S}(s_x, s_y, s_z) = \begin{pmatrix} s_x & 0 & 0 \\ 0 & s_y & 0 \\ 0 & 0 & s_z \end{pmatrix} \qquad \begin{pmatrix} x' \\ y' \\ z' \end{pmatrix} = \begin{pmatrix} s_x \cdot x \\ s_y \cdot y \\ s_z \cdot z \end{pmatrix}
Step 1 • Diagonal Matrix
S = diag(s_x, s_y, s_z)

Scale factors sit on the main diagonal

Step 2 • Coordinates Map
x' = s_x·x, y' = s_y·y, z' = s_z·z

Each 3D axis scales independently

Step 3 • Volume Factor
det(S) = s_x · s_y · s_z

Volume scales by product of all three factors

Volume Invariant: The transformation preserves 3D volume if and only if det(S) = s_x · s_y · s_z = 1.
Invariant Rule
Input Parameters
Required
1
Scale Factors sx (width), sy (height), sz (depth)
2
Matrix Dimension (3×3 Linear or 4×4 Homogeneous Affine)
3
Test 3D Point Coordinates (x, y, z)
Expected Outputs
Calculated
Generated 3×3 or 4×4 Scaling Matrix with diagonal highlights
Determinant det(S) = sx·sy·sz (exact 3D volume scaling factor)
Spatial Orientation & Chirality check (Right-Handed vs Inverted)
Transformed 3D Coordinates (x', y', z')
Developer Code Exports (Three.js, NumPy, CSS 3D, GLSL)
Worked Numerical Example
Instant Verification
Scale point P = (1.0, 1.0, 1.0) using factors sx = 2.0, sy = 1.5, and sz = 0.8.
→ x' = 2.0 × 1.0 = 2.0 y' = 1.5 × 1.0 = 1.5 z' = 0.8 × 1.0 = 0.8 Volume Scale det(S) = 2.0 × 1.5 × 0.8 = 2.4
Transformed Point P' = (2.0, 1.5, 0.8) • Volume Magnification: 2.4×
Mathematical Foundations

What is 3D Scaling in Linear Algebra?

In three-dimensional Euclidean space ℝ³, a 3D scaling transformation is a linear operator that multiplies the coordinate components of every vector by independent scalar factors along the orthogonal X, Y, and Z basis directions:

Uniform (Isotropic) Scaling
s_x = s_y = s_z = s

When all three scale factors are equal, the 3D body expands or contracts uniformly in all directions. All internal angles, aspect ratios, and geometric similarities are perfectly preserved.

Non-Uniform (Anisotropic) Scaling
s_x ≠ s_y  or  s_y ≠ s_z

When scale factors differ along at least one axis, shapes are stretched or compressed along preferred directions, transforming spheres into ellipsoids and cubes into rectangular cuboids.

Computer Graphics Standards

Why 3D Computer Graphics Uses 4×4 Homogeneous Matrices

Students often ask: "If space has 3 dimensions, why do WebGL, OpenGL, and DirectX use 4×4 matrices?"

A standard 3×3 matrix can only describe linear transformations that leave the origin (0, 0, 0) in place. Translation (moving an object across space) is not a linear transformation in ℝ³ because T(0) ≠ 0. By embedding 3D coordinates into 4D projective space as homogeneous vectors [x, y, z, 1]ᵀ, translation becomes a linear shear in 4D:

4×4 Homogeneous Scaling & Translation Formulation:
[ [s_x, 0, 0, t_x], [0, s_y, 0, t_y], [0, 0, s_z, t_z], [0, 0, 0, 1] ] · [x, y, z, 1]ᵀ = [s_x·x + t_x, s_y·y + t_y, s_z·z + t_z, 1]ᵀ

Now, rotations, scalings, shears, perspective projections, and translations can all be chained into a single 4×4 matrix multiplication executed in GPU vertex shaders.

Pivot Point Scaling

Scaling About a Custom Center Pivot C = (c_x, c_y, c_z)

When you scale an object about the origin (0, 0, 0), the object not only resizes but also shifts away from its original spatial position. To scale an object in place around its own centroid or an arbitrary pivot point C = (c_x, c_y, c_z), apply a 3-step pipeline:

1. Translate Pivot to Origin: Move pivot C to (0, 0, 0)
T(−c_x, −c_y, −c_z)
2. Apply 3D Scale: Resize coordinates symmetrically about the origin
S(s_x, s_y, s_z)
3. Translate Back to Pivot: Return the scaled object to its original world location
T(c_x, c_y, c_z)
M_pivot = T(C) · S · T(−C)  &implies;  x' = s_x(x − c_x) + c_x,   y' = s_y(y − c_y) + c_y,   z' = s_z(z − c_z) + c_z
Volume & Chirality

The Geometric Determinant: 3D Volume Scaling Factor

Because a 3D scaling matrix is diagonal, its determinant is the product of its diagonal entries:

det(S) = s_x · s_y · s_z
Determinant Value 3D Volume Effect Chirality (Handedness) Invertibility
det(S) > 0 Volume scaled by factor of |det S| Right-Handedness Preserved Invertible
det(S) = 1 Volume is strictly preserved (Isochoric) Right-Handedness Preserved Invertible
det(S) < 0 Volume scaled by |det S| Flipped (Left-Handed Reflection) Invertible
det(S) = 0 Volume collapses completely to zero Collapsed to 2D plane or line Singular (Non-Invertible)
Engineering & Industry

Applications in Engineering, Computer Graphics, & CAD

1. 3D Game Engines & Character Rigs

Engines like Unreal Engine and Unity apply scaling matrices in skeletal meshes to modify character body shapes, scale weapons, and dynamically adjust particle effect bounding volumes.

2. CAD Modeling & Unit Conversions

Industrial engineering tools (SolidWorks, AutoCAD) use uniform scaling matrices (e.g. s = 25.4) to convert mechanical assemblies seamlessly between inches and millimeters.

3. Medical Imaging & MRI Voxel Scaling

CT and MRI scans often capture non-isotropic voxels where slice thickness (Z) differs from pixel spacing (X, Y). Scaling matrices resample volumetric slices into true metric proportions.

4. Finite Element Analysis (FEA)

Structural simulation software scales stress tensors and deformation vectors along principal strain axes to compute volumetric compression and tensile elasticity in materials.

Frequently Asked Questions

How do you construct a 3×3 scaling matrix for 3D coordinates?
A 3×3 scaling matrix places the horizontal scale factor sx in row 1 col 1, vertical scale factor sy in row 2 col 2, and depth scale factor sz in row 3 col 3 along the main diagonal, with all off-diagonal entries set to 0. Multiplying this matrix by a 3D coordinate column vector [x, y, z]ᵀ produces the scaled coordinates [sx·x, sy·y, sz·z]ᵀ.
What is the difference between uniform and non-uniform (differential) 3D scaling?
In uniform (isotropic) 3D scaling, all three scale factors are equal (sx = sy = sz = s). The object expands or shrinks uniformly in all directions, preserving all angles, aspect ratios, and geometric similarity. In non-uniform (anisotropic) scaling, the scale factors differ along at least one axis, stretching or compressing the object into an altered proportions.
Why do 3D game engines and graphics APIs use 4×4 matrices instead of 3×3 matrices?
A standard 3×3 matrix can only express linear transformations that fix the origin (0, 0, 0), such as rotation and scaling. Translation (moving an object) shifts the origin and cannot be represented by 3×3 matrix multiplication. By extending coordinates into 4D projective space as homogeneous vectors [x, y, z, 1]ᵀ, 4×4 matrices can combine scaling, rotation, shearing, and translation into a single unified matrix multiplication pipeline.
How does 3D scaling affect the physical volume of an object?
The volume of any 3D body scales by the absolute value of the determinant of the scaling matrix: Volume' = |det(S)| · Volume = |sx · sy · sz| · Volume. If sx = 2, sy = 1.5, and sz = 0.8, the new volume is 2 × 1.5 × 0.8 = 2.4 times the original volume. If det(S) = 1, the transformation is isochoric (volume-preserving).
How do you scale a 3D object around an arbitrary center point (cx, cy, cz) instead of the origin?
To scale relative to a custom center point C = (cx, cy, cz), compose three steps: (1) Translate the pivot center to the origin: T(-cx, -cy, -cz); (2) Apply 3D scaling S(sx, sy, sz); (3) Translate back to the original pivot location: T(cx, cy, cz). In coordinate form: x' = sx(x - cx) + cx, y' = sy(y - cy) + cy, and z' = sz(z - cz) + cz.
What happens when a 3D scale factor is negative?
A negative scale factor reflects the geometry across the plane perpendicular to that axis. For example, if sz = -1 while sx = 1 and sy = 1, coordinates reflect across the XY-plane (z' = -z). Because det(S) = 1 × 1 × (-1) = -1 < 0, the orientation flips from right-handed to left-handed (inverted chirality), requiring 3D renderers to flip surface polygon winding orders to prevent backface culling errors.
How do you calculate the inverse of a 3D scaling matrix?
Because a scaling matrix is diagonal, its inverse is formed simply by replacing each non-zero diagonal element with its reciprocal: S⁻¹ = diag(1/sx, 1/sy, 1/sz). If any scale factor is 0, det(S) = 0, meaning the object has been flattened into a lower dimension and the transformation cannot be inverted.