無料行列計算機

行列演算を実行します: 加算、減算、乗算、転置、行列式、逆行列。

行列A

行列B

仕組み

行列AとBの寸法を定義し、値を入力して、操作を選択します。計算機は寸法を確認し、操作を実行し、結果をクリアな行列グリッドに表示します。

サポートされている演算

よくある質問

どの行列の寸法がサポートされていますか?

最大6×6の行列がサポートされています。値を入力する前に、各行列の行数と列数を選択します。

いつ逆行列を計算できますか?

行列の逆行列は、正方行列(行と列の数が同じ)で行列式が0でない場合にのみ存在します。特異な行列(行列式 = 0)には逆行列がありません。

データは保存されますか?

いいえ。すべての計算はブラウザ内で実行されます。何も保存されたり、サーバーに送信されたりしません。

What a matrix actually is

A matrix is a rectangular array of numbers arranged in rows and columns and treated as a single mathematical object. The shape is written as m × n where m is the number of rows and n the number of columns, always rows first. The individual numbers inside are entries or elements; an entry at row i, column j is referenced as aij using 1-based indexing. (One of the most common bugs in porting math papers to code is the mismatch between this 1-based convention and the 0-based indexing used by C, Python and JavaScript.)

A vector is a matrix with one row (1 × n, "row vector") or one column (m × 1, "column vector"). A scalar is a 1 × 1 matrix. This nesting matters: it means every operation in linear algebra (dot products, projections, transformations) can be expressed uniformly as matrix arithmetic, which is why matrices became the universal language of applied mathematics after 1900.

A short history

The earliest known precursor is in the Chinese Nine Chapters on the Mathematical Art (around the 2nd century BC), which used a tabular Gaussian-elimination method called fangcheng to solve simultaneous linear equations. The modern term "matrix" was coined by the English mathematician James Joseph Sylvester in 1850, drawing on the Latin word for "womb", a structure within which subdeterminants could grow. The foundational paper was Sylvester's friend and collaborator Arthur Cayley's 1858 "A Memoir on the Theory of Matrices," which formalised matrix multiplication, the identity matrix, the zero matrix and the inverse, turning matrices from a notational convenience into an algebra in their own right.

Through the late 19th and early 20th centuries Gauss-Jordan elimination, eigenvalue theory and the spectral theorem cemented matrices as the central tool of linear algebra. The 20th-century turning points were Werner Heisenberg's 1925 matrix mechanics formulation of quantum theory (which is why physicists started taking matrices seriously), John von Neumann and Herman Goldstine's 1947 paper on numerical inversion of high-order matrices that founded modern numerical linear algebra, and the 1979 release of BLAS (Basic Linear Algebra Subprograms) and 1992 release of LAPACK: the optimised libraries that every scientific-computing platform from MATLAB to NumPy ultimately calls.

The six core operations, explained

Addition and subtraction. Both matrices must have identical dimensions. The result has the same shape and each entry is the entrywise sum: cij = aij + bij. You cannot add a 2×3 to a 3×2; the operation is undefined. Matrix addition is commutative and associative, just like ordinary number addition.

Matrix multiplication. The operation that makes matrices powerful, and the one most people get wrong on a first encounter. For C = A × B to be defined, the inner dimensions must match: if A is m × n, B must be n × p, and the result C is m × p. The middle "n" cancels; the outer "m" and "p" survive. Each entry is computed as a dot product of a row of A with a column of B: cij = Σ aik · bkj summed over k.

A worked 2×2 example:

A = [1 2]   B = [5 6]   A·B = [1·5+2·7  1·6+2·8] = [19 22]
    [3 4]       [7 8]         [3·5+4·7  3·6+4·8]   [43 50]

Matrix multiplication is not commutative: A·B ≠ B·A in general, and sometimes both products are even of different shapes. (If A is 2×3 and B is 3×2, A·B is 2×2 but B·A is 3×3.) This non-commutativity is the source of much of linear algebra's richness and is why Cayley's 1858 paper is considered foundational.

Transpose: written AT: swaps rows and columns. The entry that was at row i, column j becomes the entry at row j, column i. So if A is m × n, AT is n × m. Useful identity: (A·B)T = BT·AT, with the order reversed.

Determinant: a single scalar that summarises a square matrix. For a 2×2 it's ad − bc; for larger matrices it expands recursively via cofactor expansion (impractical beyond 4×4) or via LU decomposition (the algorithm computers use, O(n³)). Geometrically, the absolute value of the determinant is the factor by which the linear map scales areas (in 2D), volumes (in 3D), and so on. A determinant of 2 means the unit square maps to a parallelogram of area 2; a negative determinant means orientation flips (a mirror reflection); a determinant of zero means the transformation collapses everything onto a line or point, the matrix is singular (non-invertible).

Inverse: written A⁻¹: the unique matrix such that A · A⁻¹ = A⁻¹ · A = I, where I is the identity matrix. The inverse "undoes" what A does. It only exists for square matrices with non-zero determinant. Computers compute inverses via Gauss-Jordan elimination or LU decomposition. For 2×2 the formula is the famous (1/det) × [d, -b; -c, a].

Why matrices matter outside textbook math

Matrices are everywhere in modern computing because every linear transformation is a matrix:

Special matrices worth knowing

Numerical-stability notes

Matrix arithmetic in floating-point hides traps that don't show up in textbook examples. The condition number of a matrix measures how much its inverse amplifies small perturbations in the input, for an ill-conditioned matrix, a 0.1% error in one entry can cause a 1000% error in the result. The classic pathological example is the Hilbert matrix (entries 1/(i+j-1)), whose condition number explodes exponentially with size; a 6×6 Hilbert matrix already has a condition number around 10⁷, meaning seven decimal digits of precision are lost in the inverse.

In practice, computational scientists almost never compute A⁻¹ explicitly. To solve A·x = b, they use LU or QR decomposition; to use the inverse implicitly, they multiply A⁻¹·b via decomposition rather than building A⁻¹ first. For ill-conditioned or rectangular systems, the SVD-based pseudoinverse (Moore-Penrose inverse) is preferred. This calculator computes the explicit inverse for educational use, which is fine at small sizes but worth noting when scaling up.

Honest scope

This calculator covers add / subtract / multiply / transpose / determinant / inverse on matrices up to 6×6, the operations a student encounters in a first linear algebra course. It does not compute eigenvalues, eigenvectors, or matrix decompositions (LU, QR, SVD); it doesn't display row-reduction steps; it doesn't support symbolic or fractional entries; it doesn't handle complex numbers; and it doesn't accept matrix expressions like A²·BT. For those features, dedicated tools (Symbolab, Wolfram Alpha, MATLAB, NumPy, Octave, SageMath) are the right step up.

More questions

Why doesn't matrix multiplication commute?

Because matrices represent transformations, and the order in which you apply transformations matters. Rotating then translating is not the same as translating then rotating, the translation drags differently from a different starting orientation. The non-commutativity of matrix multiplication is the algebraic encoding of this physical fact, and it's what makes 3D graphics and quantum mechanics interesting (and tricky).

When is a matrix not invertible?

When its determinant is zero (equivalently, when its rows (or columns) are linearly dependent) equivalently, when the linear transformation it represents collapses some non-zero vector to zero. Geometrically, the matrix maps a higher-dimensional space onto a lower-dimensional subspace and you can't recover the lost dimension. Such matrices are called "singular." For ill-conditioned-but-technically-invertible matrices, the inverse exists in theory but is wildly inaccurate in floating point, see the numerical stability section above.

Why 1-based indexing in maths but 0-based in code?

Mathematical convention dates back centuries, the first row is row 1 because counting starts at 1. Programming languages picked 0-based indexing because it simplifies pointer arithmetic on array memory: the element at offset i is at base + i × element_size, with no -1 fudge factor. Both conventions are deeply entrenched; one of the most reliable bug sources is translating a paper that says "row 3" into code that needs matrix[2].

Is there a fastest matrix multiplication algorithm?

The naive triple-loop algorithm runs in O(n³). Volker Strassen showed in 1969 that 7 multiplications suffice for 2×2 (instead of 8), giving an asymptotic O(n^2.807) when applied recursively. Successive refinements over the decades have pushed the theoretical bound down to roughly O(n^2.371), but the constants are so large that for any matrix you'd actually encounter, naive O(n³) implemented inside BLAS / cuBLAS wins. The lower bound is mathematically open: it's at least O(n²) but no one knows the exact answer.

Does anything get sent to a server?

No. The arithmetic is straightforward floating-point operations in JavaScript, computed in your browser. Nothing about your matrices leaves the page; the tool works offline once it's loaded.

関連ツール