ScalingMatrix[{sx,sy,…}]
gives the matrix corresponding to scaling by a factor si along each coordinate axis.
ScalingMatrix[s,v]
gives the matrix corresponding to scaling by a factor s along the direction of the vector v.
ScalingMatrix
ScalingMatrix[{sx,sy,…}]
gives the matrix corresponding to scaling by a factor si along each coordinate axis.
ScalingMatrix[s,v]
gives the matrix corresponding to scaling by a factor s along the direction of the vector v.
Details
- ScalingMatrix gives matrices for scaling from the origin.
- ScalingMatrix works in any number of dimensions.
Examples
open all close allBasic Examples (2)
Scaling by factors a, b, and c along the
,
, and
directions:
ScalingMatrix[{a, b, c}]//MatrixForm% . {1, 1, 1}Scaling by a factor s along the direction of the vector
:
ScalingMatrix[s, {1, -1}]//MatrixForm% . {1, -1}//TogetherScope (3)
Scaling factors can be negative or zero:
ScalingMatrix[{1, 1, -1}]ScalingMatrix[{1, 1, 1}]Transformation applied to a 2D shape:
gr = {Rectangle[], AbsolutePointSize[10], Opacity[1], {Magenta, Point[{0, 0}]}, {Green, Point[{1, 1}]}};Graphics[{{Opacity[.35], Blue, gr}, GeometricTransformation[{Opacity[.85], Red, gr}, ScalingMatrix[{1.25, .75}]]}]Transformation applied to a 3D shape:
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}, ScalingMatrix[{1.25, 1.5, .5}]]}, Boxed -> False]Applications (4)
Graphics3D[GeometricTransformation[Sphere[],
ScalingMatrix[{2, 1.5, 1}]],
Boxed -> False]Display projection of a 3D graphic:
Plot3D[Sin[x y] + 1, {x, 0, Pi}, {y, 0, Pi}, Mesh -> 3] /. gc_GraphicsComplex :> {gc, GeometricTransformation[gc, ScalingMatrix[#]]& /@ (1 + 10 ^ -3 - IdentityMatrix[3])}Transform a grayscale image by scaling with a factor of
:
ImageForwardTransformation[[image], 1 / 2ScalingMatrix[{1, 1}].#&]A pure rescaling of a 3D image:
ImageTransformation[[image], (3/2)ScalingMatrix[{1, 1, 1}].#&]Properties & Relations (5)
The determinant of ScalingMatrix[s,v] is s:
Det[ ScalingMatrix[s, {1, 1}]]The inverse of ScalingMatrix[s,v] is given by ScalingMatrix[1/s,v]:
ScalingMatrix[s, {1, 1}].ScalingMatrix[1 / s, {1, 1}]//SimplifyThe determinant of ScalingMatrix[{s1,…,sn}] is given by s1⋯ sn:
Det[ ScalingMatrix[{s1, s2, s3}]]The inverse of ScalingMatrix[{s1,…,sn}] is given by ScalingMatrix[{1/s1,…,1/sn}]:
ScalingMatrix[{s1, s2, s3}].ScalingMatrix[1 / {s1, s2, s3}]The form ScalingMatrix[{s1,…,sn}] is equivalent to DiagonalMatrix[{s1,…,sn}]:
ScalingMatrix[{s1, s2, s3}] === DiagonalMatrix[{s1, s2, s3}]See Also
Tech Notes
Related Guides
Related Workflows
- Rotate, Pan and Zoom 3D Graphics
History
Text
Wolfram Research (2007), ScalingMatrix, Wolfram Language function, https://reference.wolfram.com/language/ref/ScalingMatrix.html.
CMS
Wolfram Language. 2007. "ScalingMatrix." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ScalingMatrix.html.
APA
Wolfram Language. (2007). ScalingMatrix. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ScalingMatrix.html
BibTeX
@misc{reference.wolfram_2026_scalingmatrix, author="Wolfram Research", title="{ScalingMatrix}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/ScalingMatrix.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_scalingmatrix, organization={Wolfram Research}, title={ScalingMatrix}, year={2007}, url={https://reference.wolfram.com/language/ref/ScalingMatrix.html}, note=[Accessed: 13-June-2026]}