ForHosting KIT · Math

Hadamard product calculator

Multiply matching cells of two equal-size matrices: entries 1, 2, 3, 4 times 5, 6, 7, 8 give a top row of 5 and 12. Unlike ordinary matrix multiplication, no rows and columns are mixed. 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.

The Hadamard product multiplies two matrices entry by entry: each cell of the result is simply the product of the corresponding cells of the factors. It is sometimes called the Schur product or element-wise matrix multiplication, and it is fundamentally different from the ordinary matrix product taught first in linear algebra, which mixes entire rows with entire columns. This capability accepts two rectangular numeric matrices of identical shape, validates that every row is non-empty and rectangular, multiplies matching entries, and returns the product grid with dimensions and echoed inputs.

What the Hadamard product means and why shape must match

Write two matrices A and B that both have m rows and n columns. The result is always another m-by-n matrix; no new rows or columns appear, and no entries are dropped. This rule is the multiplicative twin of entrywise addition: where add combines corresponding cells with a plus sign, Hadamard multiplies them.

It is completely different from the ordinary matrix product A times B, which requires the column count of A to equal the row count of B and produces an m-by-p matrix whose entries are sums of products along an intermediate index. Confusing the two operations is a common homework mistake, especially when both factors happen to be square. Geometry-wise, after you flatten the arrays, Hadamard is ordinary coordinate-wise multiplication in R to the power of m times n.

Because every entry is independent of every other, the algorithm is a single nested loop: one floating-point multiply per cell. The only hard rule is dimensional agreement. If A is three by two and B is two by three, there is no standard Hadamard product in elementary linear algebra; you must reshape, pad, or refuse.

Practical use, pricing, limits, and related operations

Use the browser tool when you want an immediate element-wise product while checking homework, preparing a lecture slide, applying a binary mask to a small numeric grid, or debugging feature-map multiplications without installing a computer-algebra system. There is no language model, no external linear-algebra service, and no randomness, so the capability is safe to pin in continuous-integration checks and reproducible lesson materials. Results are fully deterministic: the same matrices always yield the same result grid.

Prefer this calculator when the problem statement says element-wise, entrywise, Hadamard, or Schur product; prefer the ordinary matrix-multiply capability when the statement asks for A times B with row-column sums. Keep entries within ordinary floating-range magnitudes so intermediate overflow is not a concern; for classroom integers and typical engineering scales the solver is exact within double precision. For entrywise addition or subtraction, determinants, inverses, or transpose, use a different capacity; this one stays intentionally focused on equal-shape element-wise multiplication.

Homework and tutoring verification

Students and graders confirm A ⊙ B for equal-size matrices, including clear failures when dimensions do not match, without a local CAS install.

Masks and feature-map pipelines

Scripts that apply binary or soft masks to grids, images, or attention weights call a deterministic Hadamard oracle instead of reimplementing shape checks in every language.

Teaching element-wise versus matrix product

Lesson pages can show Hadamard next to ordinary multiplication on the same square pair so learners see that matching shapes alone do not define A times B.

What happens if the matrix dimensions do not match?

The error message names both shapes (for example 2×3 versus 3×2) and states that the Hadamard product requires equal dimensions.

Is this the same as ordinary matrix multiplication?

No. Ordinary multiplication mixes rows of A with columns of B and needs inner dimensions to match. Hadamard multiplies corresponding entries and needs full shape equality.

Is the Hadamard product calculator free?

The browser tool runs free on your device.

Does this add or subtract matrices?

No. This capacity only performs element-wise multiplication. For entrywise add or subtract, use the matrix addition capability instead.

How is each entry of the Hadamard product worked out?

Each cell is the product of the two cells in the same row and column. In the 2 × 2 example, the top-left entry is 1 times 5, which is 5, and the top-right is 2 times 6, which is 12.

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-hadamard

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-hadamard \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"a":[[1,2],[3,4]],"b":[[5,6],[7,8]]}'
{
  "a": [
    [
      1,
      2
    ],
    [
      3,
      4
    ]
  ],
  "b": [
    [
      5,
      6
    ],
    [
      7,
      8
    ]
  ]
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "algebra.matrix_hadamard",
  "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.

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.

Unequal shapes, jagged rows, empty matrices, and non-finite cells fail with invalid_input instead of inventing padding or silent broadcasting.

What the Hadamard product means and why shape must match

Their Hadamard product C, often written A ⊙ B or A ∘ B, is defined by c_ij equals a_ij times b_ij for every row index i and every column index j. This tool refuses, with an explicit invalid_input message that names both shapes, so graders and API clients never silently accept a mismatched pair.

How to call the calculator and read the response

Each is a non-empty array of rows, and each row is a non-empty array of finite numbers. All rows of a given matrix must share the same length so the structure is rectangular. On success the response includes result (the m-by-n product), rows and cols for convenience, echo fields a and b with the parsed numeric matrices, and a short formula string that records the operation and shapes. Near-zero float dust is cleaned so goldens and demos stay stable while ordinary non-integer reals keep full double precision. Send a JSON body with required fields a and b. You may pass matrices as native JSON arrays or as JSON strings of the same nested structure. Aliases matrix_a, left, and A are accepted for the first factor; matrix_b, right, and B for the second. The engine rejects missing fields, empty matrices, jagged rows, NaN or Infinity cells, and non-numeric strings with invalid_input, and those failures are not charged. When both matrices parse cleanly but their dimensions differ, the request also fails with a message that states the two shapes, for example three by two versus two by three, and reminds you that the Hadamard product requires equal dimensions.

Practical use, pricing, limits, and related operations

Each successful request is one billable item at $0.002; failed validation and dimension mismatches do not consume balance.

How do I compute a Hadamard product with this API?

Send JSON with a and b as arrays of equal-length numeric rows of the same dimensions. The response returns result, rows, cols, echoed matrices, and a short formula string.

Read the full KIT documentation →