🔢 Matrix
Last Updated: Jan 2026
A matrix is a rectangular arrangement of numbers in rows and columns.
In programming, matrices are used to:
- Store structured data
- Apply transformations
- Perform fast computations
🗣 Hinglish Tip: Matrix ko 2D array jaisa samjho
Matrix Representation
Form
Matrix Shape (Order)
Matrix shape is written as:
rows x columns
Example:
- 2 x 3 → 2 rows, 3 columns
🗣 Hinglish Tip: Shape batata hai matrix kitna bada hai
Matrix Types
1.Row Matrix
[ 1 2 3 ]
2.Column Matrix
3.Square Matrix
Rows = Columns
4.Zero Matrix
All elements are zero.
5.Identity Matrix
Diagonal = 1, rest = 0
🗣 Hinglish Tip: Identity matrix = matrix ka 1
Matrix Operations
1.Matrix Addition
Same shape required.
2.Scalar Multiplication
3.Matrix Transpose
Rows become columns.
Used in:
- Shape matching
- Optimization problems
4.Matrix Multiplication
Rule:
(A rows x A columns) x (B rows x B columns)
A columns == B rows
If this rule fails → multiplication not possible.
🗣 Hinglish Tip: Beech ke numbers same hone chahiye
Shape of Result Matrix
(A rows x A columns) x (B rows x B columns)
→ (A rows x B columns)
🗣 Hinglish Tip: Andar wale numbers same hone chahiye
Simple Example
Matrix A:
Matrix B:
Result:
