ForHosting KIT · Math

Matrix multiplication calculator

Multiply a 2 × 3 matrix by a 3 × 2 matrix and get a 2 × 2 product: rows 1, 2, 3 and 4, 5, 6 times rows 7, 8; 9, 10; 11, 12 give 58, 64 and 139, 154. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon

Runs in your browser. Free, unlimited — your data never leaves this page.

This matrix multiplication calculator multiplies two real matrices and returns the full product matrix when the shapes are compatible. You provide a left matrix A with m rows and n columns and a right matrix B with n rows and p columns; the engine forms C equals A times B of size m by p using the standard definition that each entry C[i][j] is the sum over k of A[i][k] times B[k][j]. A classic check is the two-by-three matrix with rows [1, 2, 3] and [4, 5, 6] times the three-by-two matrix with rows [7, 8], [9, 10], and [11, 12], which yields [[58, 64], [139, 154]]. The path is pure deterministic arithmetic: no network calls, no sampling, and no date-dependent shortcuts.

How matrices are read and how the product stays finite and reproducible

Each matrix is an array of rows, and each row is an array of finite decimal numbers; scientific notation is allowed, while empty strings, objects, and non-numeric tokens are rejected with a clear field path so a bad cell does not become a wrong product entry. Optional precision between zero and fifteen decimal places rounds every published product entry for stable display; the default is ten.

Computation uses the textbook triple nested loop: for each output row index i and column index j, accumulate the sum of A[i][k] times B[k][j] over k from zero through n minus one. Intermediate sums that become non-finite are rejected rather than returned as Infinity or NaN.

Where matrix products fit in study, code, and modeling

Students meet matrix multiplication when a linear-algebra unit introduces linear maps, when a textbook asks them to multiply modest integer matrices by hand, or when they need a second method to check homework after expanding each row-column dot product. Teachers can pre-generate answer keys for small integer products without trusting opaque calculator apps that hide intermediate dimensions or silently allow incompatible shapes.

Developers call the same contract from scripts to seed deterministic test vectors for graphics transforms, small neural-network layers written by hand, constraint blocks that compose affine maps, or teaching platforms that must show the product matrix alongside the factors. Contest practice often needs a fast, offline matrix product so solutions can be checked without writing a full linear-algebra library under time pressure.

Analysts and engineers use two-factor products when a small model collapses to composing linear maps and they want an explicit, documented path rather than a black-box BLAS call for matrices that fit in a few dozen rows.

Homework and exam answer keys

Multiply textbook matrices A and B, check the product shape m×p, and verify each entry against hand-worked row-column sums.

Small transform and model checks

Compose modest linear maps or feature transforms when both factors fit within the published row and column limits.

What does the matrix multiplication calculator cost?

It is free in your browser on this page.

When are two matrices compatible for multiplication?

The number of columns of the first matrix must equal the number of rows of the second.

What shape is the product?

If A is m×n and B is n×p, the product C is m×p. Each C[i][j] is the sum over k of A[i][k] times B[k][j].

Is matrix multiplication commutative?

No in general. Even when both A×B and B×A exist, they need not be equal. This tool always computes A×B in that order.

What size matrices are supported?

Each factor may have up to 50 rows and 50 columns, with each entry within the published magnitude ceiling. Larger shapes are rejected.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/algebra/matrix-multiply

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/algebra/matrix-multiply \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"a":[[1,2,3],[4,5,6]],"b":[[7,8],[9,10],[11,12]]}'
{
  "a": [
    [
      1,
      2,
      3
    ],
    [
      4,
      5,
      6
    ]
  ],
  "b": [
    [
      7,
      8
    ],
    [
      9,
      10
    ],
    [
      11,
      12
    ]
  ]
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "algebra.matrix_multiply",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

max_rows50
max_cols50
max_abs_entry1000000000000000
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

If the number of columns of the first matrix does not equal the number of rows of the second, the request is rejected with a clear invalid_input message instead of inventing a padded or truncated product.

What matrix multiplication means and what the response contains

Matrix multiplication combines a left factor A of shape m by n with a right factor B of shape n by p into a product C of shape m by p. Compatibility is strict: the inner dimensions must match, so columns of A must equal rows of B; otherwise there is no defined product under the usual rules of linear algebra. Each entry of C is a dot product of one row of A with one column of B, which is why the operation is associative in the compatible multi-factor case but not commutative in general—A times B need not equal B times A even when both products exist. This calculator returns the product matrix with every entry rounded to the requested precision, the echoed factors A and B, the four shape numbers rows_a, cols_a, rows_b, and cols_b, the product dimensions, the precision used, a short formula string documenting the triple-loop rule, and the published maxima so clients can validate before they send a batch. There is no approximate randomized multiplication presented as truth and no silent padding of unequal inner dimensions: the engine either builds the exact floating-point product inside the supported range or rejects the input with invalid_input. Rejected cases include missing A or B, non-array rows, jagged non-rectangular matrices, empty rows, non-finite cells, magnitudes beyond the published ceiling, matrices larger than the row or column limits, and any pair whose columns of the first do not equal rows of the second.

How matrices are read and how the product stays finite and reproducible

The preferred fields are a for the left matrix and b for the right matrix, but aliases matrix_a, left, and A for the first factor and matrix_b, right, and B for the second are accepted so spreadsheets, query strings, and typed forms can reuse the same contract. The engine enforces hard maxima of fifty rows and fifty columns on each factor and a magnitude ceiling on every entry so edge Worker and free-browser runs stay inside a predictable numeric budget even though the triple loop is cubic in the shared inner dimension. Pair the free browser run on this page with the priced API when you need the identical mathematical result inside an automated pipeline without re-implementing dimension checks and the triple loop yourself.

Where matrix products fit in study, code, and modeling

On this page the work runs entirely in your browser; through the API each successful product costs $0.002, failed validation is not charged, and nothing is stored after the response returns. That split — free interactive exploration and a priced, identical API — matches the rest of the KIT tier-A catalog and lets you move from a classroom demo to an automated pipeline without changing the mathematical result. Pair it with 3×3 system solvers or other algebra endpoints when you are building a small lab of free, deterministic linear-algebra helpers, and with combinatorics tools when you need related discrete counts rather than continuous matrix arithmetic.

Deterministic CI fixtures

Generate reproducible product matrices for unit tests without hand-maintaining triple-loop expansions or dimension checks.

Read the full KIT documentation →