Definition and Types
Definition of Matrices
A matrix is a rectangular array of numbers, symbols, or expressions arranged in rows and columns. In general, a matrix with m rows and n columns is called an matrix.
General form of a matrix A:
Where represents the element in the i-th row and j-th column.
In PHP matrices can be written like n-dimensional arrays:
// 1-dimensional array
$matrixD1 = [1, 2];
// 2-dimensional array
$matrixD2 = [
[1, 2],[3, 4],[5, 6]
];
// 3-dimensional array
$matrixD3 = [
[
[1, 2, 3],
[4, 5, 6],
[7, 8, 9]
],
[
[10, 11, 12],
[13, 14, 15],
[16, 17, 18]
],
[
[19, 20, 21],
[22, 23, 24],
[25, 26, 27]
]
];
Types of Matrices
Row matrix:
A matrix with only one row .
Example:
Column matrix:
A matrix with only one column .
Example:
Square matrix:
A matrix with an equal number of rows and columns .
Example:
Diagonal matrix:
A square matrix where all elements outside the main diagonal are zero.
Example:
Identity matrix:
A square matrix with 1s on the main diagonal and 0s elsewhere, usually denoted by .
Example:
Zero matrix:
A matrix where all elements are zero, usually denoted by 0.
Example:
Symmetric matrix:
A square matrix that is equal to its transpose .
Example:
Skew-symmetric matrix:
A square matrix A where .
Example:
Upper triangular matrix:
A square matrix where all elements below the main diagonal are zero.
Example:
Lower triangular matrix:
A square matrix where all elements above the main diagonal are zero.
Example:
Understanding these types of matrices is crucial for working with more advanced concepts in linear algebra, such as matrix operations, determinants, and eigenvalues
Last updated