2. Matrix operations
The
following re the common operations are performed on matrix in ML
1. 1. Transpose
2. 2. Addition
of Matrix
3. 3. Subtraction
of Matrix
4. 4. Multiplication
of matrix
One
important operation on matrices is the transpose. The transpose of a
matrix is the mirror image of the matrix across a diagonal line, called the
main diagonal, running down and to the right, starting from its upper left
corner. We can represent as (AT)i,j = Aj,i
Vectors
can be thought of as matrices that contain only one column. The transpose of a
vector is therefore a matrix with only one row. A vector by writing out its
elements in the text inline as a row matrix, then using the transpose operator
to turn it into a standard column vector,
e.g., x = [x1, x2, x3 ]T
2 &3 .
Addition & Subtraction of Matrix
We
can add matrices to each other, as long as they have the same shape, just by
adding their corresponding elements.
Example
C = A + B where Ci,j = Ai,j + Bi,j .
We
can also add a scalar to a matrix or multiply a matrix by a scalar, just by
performing that operation on each element of a matrix.
Exaple
D = a * B + c where Di,j = a * Bi,j + c
4. Multiplying Matrices and Vectors
One
of the most important operations involving matrices is multiplication of two
matrices. The matrix product of matrices A and B is a third matrix C. In order
for this product to be defined, A must have the same number of columns as B has
rows. If A is of shape m × n and B is of shape n × p, then C is of shape m × p.
We can write the matrix product just by placing two or more matrices together,
e.g. C= AB
The
product operation is defined by Ci,j = ∑ Ai,kBk,j
Matrix
product operations have many useful properties that make mathematical
analysis of matrices more convenient.
For example, matrix multiplication is
distributive:
A(B
+ C) = AB + AC
It is also associative:
A(BC)
= (AB)C
Matrix
multiplication is not commutative (the condition AB = BA does not always hold),
unlike scalar multiplication. However, the dot product between two vectors is
commutative: xTy = yTx.
No comments:
Post a Comment