Home / Blog / Math & Scientific

Math & Scientific

Use Matrices to Transform and Plot Coordinate Points

Calculate matrix transformations of plotted points, keep row and column conventions straight, and distinguish coordinate graphs from heatmaps and networks.

Use Matrices to Transform and Plot Coordinate Points

Choose what the matrix is meant to represent

A matrix graph can mean several different displays. A grid of coloured cells shows entry magnitudes as a heatmap. A graph-theory adjacency matrix describes connections between labelled vertices. A transformation matrix maps coordinate vectors to new points in a plane or higher-dimensional space. These interpretations require different data and plotting rules. The local calculator provides arithmetic, so decide the interpretation first instead of assuming that every numeric matrix automatically defines the same kind of graph.

Store plane points as columns

Take a triangle with vertices P=(1,1), Q=(3,1) and R=(2,2). Arrange them as columns in B with first row 1,3,2 and second row 1,1,2. Each column contains one point's x and y coordinates. A 2-by-2 transformation matrix A can then multiply B to produce another 2-by-3 matrix of transformed columns. If the points were stored as rows, this multiplication order would need to change. Record the convention before entering values so that a valid matrix product is also the intended geometric operation.

Rotate the triangle counterclockwise by ninety degrees

Use A with rows 0,−1 and 1,0. For a column(x,y), multiplication gives (−y,x), a ninety-degree counterclockwise rotation about the origin. With the three columns above, A×B has rows −1,−1,−2 and 1,3,2. The transformed vertices are P′=(−1,1), Q′=(−1,3) and R′=(−2,2). Enter A and B in the local form, select multiplication, and read the resulting columns in the same order as the originals.

Plot the calculated vertices in a separate graph

Place the three original points on axes using the same horizontal and vertical scale, then join P to Q to R to P. Plot and join the transformed points in the corresponding order. A rotation preserves lengths and angles, so the original horizontal side from (1,1) to (3,1)has length 2 and becomes the vertical side from (−1,1) to (−1,3), also length 2. The arithmetic output alone does not draw these segments; the vertex order is information supplied by the problem.

Compare with a shear transformation

For a second example, use A with rows 1,2 and 0,1 while keeping B unchanged. The mapping is (x,y) to (x+2 y,y). The output rows are 3,5,6 and 1,1,2, giving transformed vertices (3,1),(5,1),(6,2). The shape is sheared rather than rotated. Its determinant is 1, so it preserves signed area, but it does not generally preserve lengths or angles. This comparison shows why inspecting the transformation rule is more informative than looking only at the array size.

Understand composition order

Applying a shear S and then a rotation R to a point produces R(Sv)=(RS)v. Reversing the order gives (SR)v, which generally differs. For v=(1,1), the shear above gives (3,1), then the ninety-degree rotation gives (−1,3). Rotating first gives (−1,1), then shearing gives (1,1). Matrix multiplication is not commutative, so the order of transformations must match the order of factors when building a combined matrix.

Recognize the limits of a two-by-two linear map

A 2-by-2 linear transformation fixes the origin because multiplying its zero vector gives zero. A translation that moves every point by the same nonzero offset therefore cannot be represented by such a matrix alone. It can be handled by adding an offset vector or by a homogeneous-coordinate formulation with an added coordinate and a larger matrix. Do not expect entering a translation vector as if it were a two-by-two matrix to produce the intended graph.

Keep network and heatmap interpretations distinct

If a matrix is an adjacency matrix, row and column labels identify vertices and entries describe edges or weights according to an explicitly chosen convention. Its multiplication has a graph-theoretic meaning different from transforming plane coordinates. A heatmap instead needs a value scale, colour legend and decisions about missing or signed entries. The local arithmetic form supplies none of those drawing controls. For a coordinate transformation, report the original points, matrix, multiplication order and transformed coordinates so that a separate plot can be reproduced accurately.

Calculator for the supported step

The local Matrix Calculator performs matrix arithmetic and returns a numeric array. It does not draw a coordinate graph, heatmap or network diagram. The examples calculate transformed coordinates that you can plot separately in the stated vertex order.

Open Matrix Calculator

Sources and method

Georgia Tech Interactive Linear Algebra: matrix transformations