The four operations side by side
Three of these operations never change a value. Transpose, rotate and flip are rules for where each cell goes, so every one of them costs one read and one write per cell, rows × cols steps. Multiplication is different: it builds new numbers, and every cell of the result needs a whole loop of its own.
The rules for rotate and flip are shown for the clockwise and horizontal versions; the other direction of each swaps which index gets the − 1 − treatment. Every page has a toggle for both.
Which one should you learn first?
Start with transpose: it is the plainest index rule, B[j][i] = A[i][j], and the piece the others are built from. Then rotate, which is the same loop with a rows − 1 − i in the target, and flip, which mirrors one index and keeps the shape. A clockwise rotation is a transpose followed by a horizontal flip, so once you know two of them you know the third.
Finish with multiplication. It needs a second matrix, a size rule, and three nested loops, and it is the first O(n³) algorithm most people meet. The page bands the current row and column so the row-times-column sum is visible as it grows.
Each page keeps your grid when you switch, so try one matrix in all four operations and compare the results. When the index rules feel natural, the same grids are waiting on the grid algorithm pages: flood fill, number of islands and BFS shortest path.
What the visualizer shows
On every page the source matrix A sits on the left and the result on the right, both with row and column numbers. Each step reads one cell of A, marked in amber, and writes one cell of the result, marked in pink; finished cells turn green, and the index labels follow the two pointers so you can check the formula against what actually happened. The counters underneath count reads and writes, and the message spells out the assignment in full, such as B[2][1] = A[1][2] = 7.
The multiplication page adds a third matrix. The current row of A and column of B are banded, the two cells being multiplied are highlighted, and the result cell shows its running sum until the last product is added. The chips above the counters list the terms of the sum so far.
Matrix operation questions
What are the basic matrix operations?
The ones that move cells around, transpose, rotate and flip, and the ones that compute new values, addition and multiplication. Transpose, rotate and flip are index tricks: each cell of the source lands at a new position, so they cost one step per cell. Multiplication combines a row of one matrix with a column of the other and costs far more.
How are transpose, rotate and flip related?
A rotation by 90° clockwise is a transpose followed by a horizontal flip. A rotation by 180° is a horizontal flip followed by a vertical flip. Transposing twice, flipping twice the same way, or rotating four times all give the original matrix back.
Can I use my own matrix?
Yes. Paste or build a grid in the 2D Array Visualizer and use the Transform this grid links under it, or use the size sliders and the Random button on any operation page. The Copy link button gives you a URL that reopens the same matrices at the same step.
Which operation should I learn first?
Transpose. It is the simplest index rule and the building block of the others. Rotate and flip are the same loop with a different target index, and once those feel familiar the three nested loops of multiplication are the natural next step.