Linear Algebra

Identity Matrix

Generate an n×n identity matrix.

Formula

Formula
Iij = 1 if i=j else 0

Variables

SymbolDefinitionType & rangeUnitsRole
n matrix size integer (ℤ) input

Try it yourself

Interactive calculator
Result

Worked examples

Example 1
Givenn = 4
Result
1000
0100
0010
0001
Example 2
Givenn = 2
Result
10
01