Matrix A (m×n)
Vector x (n×1)
| Preset | Matrix A | Vector x | Action |
|---|---|---|---|
| 3×3 Demo | [[2, -1, 0], [3, 4, 1], [0, 5, 2]] | [1, 2, 3] | |
| 2×4 Dense | [[1.2, 0, -3.5, 2], [4, 5.5, 0.75, -1]] | [0.5, 2, -1, 3] |
Matrix–vector multiplication forms a new vector \( \mathbf{y} \in \mathbb{R}^{m} \) from a matrix \( \mathbf{A} \in \mathbb{R}^{m\times n} \) and a vector \( \mathbf{x} \in \mathbb{R}^{n} \):
\( \mathbf{y} = \mathbf{A}\mathbf{x} \)
The i-th entry is the dot product of row i of \( \mathbf{A} \) and \( \mathbf{x} \):
\( y_i = \sum_{j=1}^{n} a_{ij}\,x_j \quad \text{for } i=1,\dots,m \)
Time complexity is \(O(mn)\). Values are computed in double precision and displayed with the selected rounding.
- Set the number of rows \(m\) and columns \(n\). Vector length is \(n\).
- Enter values directly in the grids, or paste from the text areas.
- Click Calculate to compute \( \mathbf{y} = \mathbf{A}\mathbf{x} \).
- Toggle Show steps to see each row’s dot product expansion.
- Export results via CSV or PDF, or copy steps for reports.
- Use Shareable URL to preserve inputs for later or teammates.
- Empty cells are treated as zero. Use precision control for rounding only the display.
- Local storage remembers your latest session on this device.
- Linear systems step: Given \( \mathbf{A} \) and an iterate \( \mathbf{x} \), compute \( \mathbf{A}\mathbf{x} \) inside iterative solvers (CG, GMRES).
- Computer graphics: Apply linear transforms to coordinates, where \( \mathbf{x} \) contains point components.
- Dynamics & control: State update \( \mathbf{x}_{k+1} = \mathbf{A}\mathbf{x}_k + \mathbf{b} \).
- Markov chains: Next-state probabilities from transition matrix times distribution vector.
- Neural networks: Dense layer output \( \mathbf{y} = \mathbf{W}\mathbf{x} + \mathbf{b} \).
- Data pipelines: Feature mixing, filters, and dimensionality reduction steps.
Use this tool to prototype the multiply step before coding full pipelines.
- Complexity: \(O(mn)\) multiplies and adds; cost grows with size.
- Sparsity: Exploit zero entries by storing nonzeros only; compute faster and use less memory.
- Conditioning: Sensitivity obeys \( \frac{\lVert \Delta \mathbf{y}\rVert}{\lVert \mathbf{y}\rVert} \lesssim \kappa(\mathbf{A}) \frac{\lVert \Delta \mathbf{x}\rVert}{\lVert \mathbf{x}\rVert} \), where \( \kappa(\mathbf{A}) \) is the condition number.
- Scaling: Normalize inputs to mitigate overflow/underflow; prefer comparable magnitudes.
- Accumulation order: Summation order affects rounding error; Kahan summation reduces drift.
- Cache locality: Row-major access improves throughput for \( \mathbf{A}\mathbf{x} \) on typical CPUs.
Displayed precision affects formatting only; raw computations keep full double precision internally.
1) What sizes are compatible for multiplication?
Matrix \( \mathbf{A} \) must be \( m\times n \) and vector \( \mathbf{x} \) must be length \( n \). The result \( \mathbf{y} \) has length \( m \).
2) Does the calculator support decimals and negatives?
Yes. You can use integers, decimals, and negative values. Display rounding is configurable from 0 to 8 decimal places.
3) Why do I see a dimension mismatch alert?
If your vector length does not equal the number of matrix columns, multiplication is undefined. Adjust either \( n \) or the vector length.
4) Is right-multiplication \( \mathbf{x}^\top \mathbf{A} \) supported?
This tool evaluates \( \mathbf{A}\mathbf{x} \). Right-multiplication produces a row vector and requires different dimensions and layout.
5) How are the steps derived?
Each step shows a dot product expansion of a row of \( \mathbf{A} \) with \( \mathbf{x} \), listing term-by-term multiplications and their sum.
6) Will exporting change my numbers?
No. CSV exports the raw computed values. PDF captures the rendered view with your chosen precision and formatting.