MMULT Function (Gnumeric)
Multiply compatible Gnumeric matrices with MMULT, lay out array results, verify row-column products and keep input coercion and shape errors explicit.
Verification status: See the evidence and test scope described in this guide. How formula examples are checked
Quick answer: MMULT computes row-by-column matrix multiplication. A 2-by-3 matrix times a 3-by-2 matrix produces a 2-by-2 result, not a pairwise product of corresponding cells.
Availability and evidence
- Introduction: Gnumeric 0.30: NEWS explicitly lists MMULT with TRANSPOSE as added functions.
- Source support: Registered in the Gnumeric 1.12.62 plugin. No retirement is established. The last functioning application version is unverified for this guide.
- Evidence dates: Official 1.12.62 source was retained October 13–14, 2026 and reviewed October 15. Exact string and rational-matrix reference checks are independent calculations, not native Gnumeric, headless application or GUI execution.
Syntax, dimensions and entry
=MMULT(mat1,mat2)
Both arguments are required arrays or ranges. If the first is m rows by k columns, the second must be k rows by n columns. The result has m rows and n columns. In the pinned callback, incompatible inner dimensions or an empty matrix produces #VALUE!.
For each output row r and column c, multiply matching entries from row r of the first input and column c of the second, then add those products. Written with a shared inner index i, the result is the sum of A[r,i]*B[i,c]. Matrix order matters; reversing arguments can change the result or make the shapes incompatible.
Gnumeric’s pinned manual documents selecting the full result range, entering the formula and pressing Ctrl+Shift+Enter. The worksheet instructions below follow that array-entry procedure. They do not certify an automatic spill UI or a fresh application execution.
Complete rectangular multiplication worksheet
Create MatrixProduct. Enter the first matrix in A2:C3 and the second in E2:F4:
| Row | A | B | C | E | F |
|---|---|---|---|---|---|
| 2 | 1 | 2 | 3 | 7 | 8 |
| 3 | 4 | 5 | 6 | 9 | 10 |
| 4 | leave outside first matrix | leave outside first matrix | leave outside first matrix | 11 | 12 |
Select H2:I3 and enter =MMULT(A2:C3,E2:F4) as an array formula. The exact reference result is:
| Row | H | I |
|---|---|---|
| 2 | 58 | 64 |
| 3 | 139 | 154 |
H2 is 17+29+311=58. I3 is 48+510+612=154. These are checks of different row-column pairings, so swapping a range or including a header becomes easier to spot.
In a copy change C2 from 3 to 4. The output becomes 69,76;139,154. Only the first output row changes, by the second matrix’s third row 11,12. This is a stronger diagnostic than checking only the grand total.
Small reference controls
| Control | Independent reference result |
|---|---|
A 2-by-3 times B 3-by-2 |
[58,64; 139,154] |
[1,2] times [3;4] |
[11] |
[1,-1] times [1;1] |
[0] |
[0.5,1.5] times [2;4] |
[7] |
2-by-3 times 2-by-2 |
#VALUE! |
Identity2 times [2,3;5,7] |
[2,3; 5,7] |
The numeric controls are exact integer or rational calculations, while the shape error is established by the callback guard. Bracketed arrays here describe rows separated by semicolons; they are mathematical notation, not a claim about localized array-literal punctuation. Enter the values into ordinary cells.
Advanced: apply two sets of prices to quantities
On ScenarioCosts, use the original A2:C3 values as quantities of three products in two orders. Use E2:F4 as two price scenarios, one scenario per column. The result gives two totals per order: 58,64 for the first and 139,154 for the second.
To model a one-unit increase in the third product of the first order, use the changed C2 control above. The cost increases by 11 in scenario one and by 12 in scenario two. Matrix multiplication keeps the scenario dimension separate instead of adding unlike prices together.
Keep the product order identical in both input tables. Matching dimensions do not prove that the third quantity corresponds to the third price. Label rows and columns outside the numeric input ranges, and verify units before interpreting the results as money or other quantities.
Advanced: show why order is not interchangeable
Reversing the original ranges gives =MMULT(E2:F4,A2:C3), a 3-by-3 array. Select a separate three-row, three-column output region. Its reference rows are 39,54,69, 49,68,87, and 59,82,105. The original product was 2-by-2, so these cannot be interchangeable results.
For a square input 2,3;5,7, multiplication by MUNIT(2) on either side preserves 2,3;5,7. That identity control helps diagnose input ordering without implying that arbitrary matrix pairs commute. Do not round individual products before adding them unless a separate calculation policy explicitly requires it.
Errors, blanks and data typing
The shared matrix reader propagates any error cell before multiplication. Its conversion helper maps a physically empty cell to zero and TRUE/FALSE to one/zero. Those are source-backed coercions, not a reason to leave missing measurements blank: an accidental blank can silently change a total.
Text is passed through a numeric conversion helper rather than being uniformly rejected as in some other products. This guide does not certify locale-dependent strings, malformed text or trailing-character parsing. Use actual numeric cells for reproducible matrices and validate imported data before multiplying.
An input header accidentally included in a range can therefore be more dangerous than a simple dimension error. Separate labels from numeric blocks. A #VALUE! result should prompt a shape check; a propagated source error should prompt inspection of the original cell. Huge arrays, overflow, backend rounding and file round trips remain outside native verification. Reference integers here are small enough that mathematical interpretation is unambiguous.