You are on page 1of 28

LESSON 0.

MATRICES
Mathematics Applied to Marketing
Matrices

■ A matrix is, basically, an organized box that


contains information. In this subject, we will
assume that our matrices contain only numbers.
■ We say a matrix is mxn when it has m rows and n
columns. This is the matrix order or dimension.
1 2 −4
■ Example: This matrix dimension is
3 −1 0
2x3.

Mathematics Applied to Marketing 2


Matrices

■ When a matrix has n columns and n rows, it is


named square matrix.
0 1
■ Example: is a square matrix of order 2.
3 −2
■ A triangular matrix is a matrix with all entries above
the main diagonal equal to zero (lower triangular) or
with all entries below the main diagonal equal to
zero (upper triangular).
−𝟐 0 0
■ Example: 1 𝟏 0
−5 9 −𝟑
Mathematics Applied to Marketing. 3
Matrices

■ In case we have a square matrix in which all entries


outside the main diagonal are equal to zero, we will
say the matrix is diagonal.
■ The identity matrix of size n is the nxn square
matrix with ones on the main diagonal and zeros
elsewhere.
■ The trace of a square matrix is the sum of the
elements on the main diagonal: 𝑡𝑟 𝐴 = ∑3245 𝑎22
−2 0 0
■ Example: 𝐴 = 1 1 0 tr(A)=-4
−5 9 −3
Mathematics Applied to Marketing.
4
Matrix addition

■ To add two matrices, both must have an equal


number of rows and columns. The result of this
addition will be a matrix with the same number of
rows and columns.
■ The sum of A and B is denoted A+B, and is
computed by adding corresponding elements of A
and B. Let’s see how to do it with square matrices
of order 2:
𝑎99 𝑎9: 𝑏99 𝑏9: 𝑎99 + 𝑏99 𝑎9: + 𝑏9:
𝐴+𝐵 = 𝑎 𝑎:: + =
:9 𝑏:9 𝑏:: 𝑎:9 + 𝑏:9 𝑎:: + 𝑏::

Mathematics Applied to Marketing. 5


Matrix addition

■ Example:

1 4 −2 0 1 + (−2) 4+0
−1 0 + 3 3 = −1 + 3 0+3
0 2 −1 −5 0 + (−1) 2 + (−5)
−1 4
= 2 3
−1 −3

Mathematics Applied to Marketing. 6


Multiplication by a scalar

■ To multiply a matrix by a number (scalar), we just


have to take the number and multiply it on every
entry in the matrix.
■ Example:
1 4 3>1 3> 4 3 12
3 > −1 0 = 3 > (−1) 3 > 0 = −3 0
0 2 3>0 3> 2 0 6

Mathematics Applied to Marketing. 7


Matrix multiplication

■ Let A be a mxn matrix and B a nxp matrix. Their


matrix product, AB is a mxp matrix. Thus the
product AB is defined only if the number of
columns in A is equal to the number of rows in B, in
this case n.
𝑎99 ⋯ 𝑎93 𝑏99 ⋯ 𝑏9E
■ 𝐴= ⋮ ⋱ ⋮ ,𝐵 = ⋮ ⋱ ⋮ , then
𝑎C9 ⋯ 𝑎C3 𝑏39 ⋯ 𝑏3E

Mathematics Applied to Marketing. . 8


Matrix multiplication

(𝐴𝐵)99 (𝐴𝐵)9: (𝐴𝐵)9E



(𝐴𝐵):9 (𝐴𝐵):: (𝐴𝐵):E
𝐴𝐵 = ,
⋮ ⋱ ⋮
(𝐴𝐵)C9 (𝐴𝐵)C: ⋯ (𝐴𝐵)CE
where (𝐴𝐵)2F = ∑CG49 𝑎2G 𝑏GF
■ Don’t forget that matrix multiplication is not
commutative, i.e. AB≠BA.

Mathematics Applied to Marketing. 9


Matrix multiplication

■ Example:
−2 0
1 −1 0
𝐴= ,𝐵 = 3 3 thus AB will
4 0 2 :HI
−1 −5 IH:
be a square matrix of order 2.

Mathematics Applied to Marketing. 10


Matrix multiplication

■ Example:
Step 1: We multiply the first row in A by the first
column in B
−2 0
1 −1 0
𝐴= ,𝐵 = 3 3
4 0 2 :HI
−1 −5 IH:
(𝐴𝐵)99 = 1 > −2 + −1 > 3 + 0 > −1 = −2 − 3
= −5
−5 ↓
𝐴𝐵 =
↓ ↓

Mathematics Applied to Marketing. 11


Matrix multiplication

■ Example:
Step 2: We multiply the first row in A by the second
column in B
−2 0
1 −1 0
𝐴= ,𝐵 = 3 3
4 0 2 :HI
−1 −5 IH:
(𝐴𝐵)9: = 1 > 0 + −1 > 3 + 0 > −5 = −3
−5 −3
𝐴𝐵 =
↓ ↓

Mathematics Applied to Marketing. . 12


Matrix multiplication

■ Example:
Steps 3 and 4: We multiply the second row in A by the
columns in B to obtain:
−5 −3
𝐴𝐵 =
−10 −10

Mathematics Applied to Marketing. 13


Transpose of a matrix

■ The transpose of a matrix A is another matrix, At,


which is formed by turning all the rows of the given
matrix into columns and vice versa. If A was an mxn
matrix, the order of At will be nxm.
■ Example:
1 4
1 −1 0
𝐴= , 𝐴K = −1 0
4 0 2 :HI
0 2 IH:

Mathematics Applied to Marketing. 14


Determinant of a matrix

■ Associated with each square matrix is a real


number called its determinant. The determinant of
a matrix A is denoted by det A or by |A|.
■ Square matrices of order 2:
𝑎 𝑏 𝑎 𝑏
det 𝐴 = det = = 𝑎𝑑 − 𝑏𝑐
𝑐 𝑑 𝑐 𝑑

Mathematics Applied to Marketing. 15


Determinant of a matrix

■ Square matrices of order 3:

Mathematics Applied to Marketing. 16


Determinant of a matrix

■ Square matrices of order ≥ 3:


If A is a square matrix of order 3 or more, we can use another
method to compute its determinant: using the definition of the
determinant of an order 2 matrix to define the rest of
determinant.

Mathematics Applied to Marketing. 17


Determinant of a matrix
■ Properties of the determinant
o Let A be an nxn matrix. Then det At = det A.

o If A is a matrix with a row where every entry is zero, or a column where every entry is zero, then det
A=0.

o Let B be the square m atrix obt ained from A by interchanging the location of two rows, or interchanging
the location of two columns. Then det(B)=−det(A).

o Suppose that A is a square matrix with two equal rows, or two equal columns. Then det(A)=0.

o Suppose that A is a square matrix. Let B be the square matrix obtained from A by multiplying a single
row by the scalar α, or by multiplying a single column by the scalar α. Then det(B)=αdet(A).

o If corresponding entries in two rows are proportional, then det A=0.

o Let A and B be square matrices of order nxn. Then, det(A>B)=det(A) >det(B)=det(B) >det(A)=det(B>A).

o Let B be a matrix in which a row is obtained by adding its elements to the entries of another row
multiplied by a real number (i.e. the row is a linear combination). Then det(B)=det(A).

Mathematics Applied to Marketing. 18


Determinant of a matrix
■ Properties of the determinant
o Let A be an nxn matrix. Then det At = det A.

o If A is a matrix with a row where every entry is zero, or a column where every entry is zero, then det
A=0.

o Let B be the square m atrix obt ained from A by interchanging the location of two rows, or interchanging
the location of two columns. Then det(B)=−det(A).

o Suppose that A is a square matrix with two equal rows, or two equal columns. Then det(A)=0.

o Suppose that A is a square matrix. Let B be the square matrix obtained from A by multiplying a single
row by the scalar α, or by multiplying a single column by the scalar α. Then det(B)=αdet(A).

o If corresponding entries in two rows are proportional, then det A=0.

o Let A and B be square matrices of order nxn. Then, det(A>B)=det(A) >det(B)=det(B) >det(A)=det(B>A).

o Let B be a matrix in which a row is obtained by adding its elements to the entries of another row
multiplied by a real number (i.e. the row is a linear combination). Then det(B)=det(A).

Mathematics Applied to Marketing. 19


Determinant of a matrix

Mathematics Applied to Marketing. 20


Determinant of a matrix

Mathematics Applied to Marketing. 21


Rank of a matrix
■ Let A be a square matrix of order n. If det(A)=0,
then the matrix is said to be singular. This means
that at least one row and one column are linearly
dependent on the others. If this row and column
are removed, we are left with another matrix, say
An−1, to which we can apply the same criterion.
Suppose that we eventually arrive at an rxr matrix
Ar whose determinant is nonzero. Then matrix A is
said to have rank r, and we write rank(A) = r.
■ If det(A)≠0, then A is said to be nonsingular. The
rank of a nonsingular nxn matrix is equal to n.
■ In conclusion, the rank of a matrix A is the order of
the largest nonzero square submatrix determinant. 22
Rank of a matrix
1 0 −2
■ Example: 𝐴 = 10 −3
2
4
6
, 𝐵 = −5 3 −4 ,
3 −4 1
1 0 3
𝐶= 4 5 6
−4 0 −12
■ In A, the largest order of a square matrix we can find is 2, so 𝑟𝑎𝑛(𝐴)
has to be≤ 2. If we find a nonzero determinant of order 2, we will
1 −3
have finished. Let’s take the following submatrix: . Its
0 2
determinant is 2≠0, so 𝑟𝑎𝑛 𝐴 = 2.
■ 𝑟𝑎𝑛(𝐵) ≤ 3, as it is an square matrix. As det 𝐵 = −35 ≠ 0, and the
order of B is 3, then 𝑟𝑎𝑛 𝐵 = 3.
■ Finally, det 𝐶 = 0, so 𝑟𝑎𝑛 𝐶 < 3 and we have to find a submatrix
1 3
of order 2 or less with a nonzero determinant. If we take , its
4 6
determinant is -6≠0, so 𝑟𝑎𝑛 𝐶 = 2.
23
Inverse of a matrix
■ Let A be a nonsingular square matrix of order n.
The matrix inverse, A-1, is a matrix such that AA-1=I,
where I is the identity matrix of order n.
■ Why is it useful? We need the inverse of a matrix
because with matrices we can't divide. But we can
multiply by an inverse, which achieves the same
thing.
To solve a matrix equation 𝐴𝑥+𝑏=𝑐, we need 𝐴−1:
𝐴𝑥 + 𝑏 = 𝑐 ; 𝐴𝑥 = 𝑐 − 𝑏; 𝐴−1 𝐴𝑥 = 𝐴−1 𝑐 − 𝑏 ; 𝐼𝑥
= 𝐴−1 𝑐 − 𝑏 ; 𝑥 = 𝐴−1 𝑐 − 𝑏
■ This equation will have a solution if and only if A is
nonsingular.
24
Inverse of a matrix

25
Systems of linear equations
■ We can write a system of linear equations as a
matrix equation Ax=b to be solved as we will see
later. If A is a mxn matrix, named coefficient matrix,
x is a column vector with n entries, and b is a
column vector with m entries. We will see an
example:
2𝑥 − 𝑦 + 2𝑧 = 1
■ Example: [3𝑥 + 2𝑦 + 3𝑧 = 0 →
5𝑥 − 2𝑦 = 1
2 −1 2 𝑥 1
𝐴 = 3 2 3 ,𝑥 = 𝑦 ,𝑏 = 0
5 −2 0 𝑧 1
2 −1 21
■ The augmented matrix is 𝐴 𝑏 = 3 2 30
5 −2 01 26
Systems of linear equations
Solving Systems of Linear Equations
■ We will discuss the number of solutions of a system
of linear equations using the Rouché–Capelli
theorem (Rouché-Frobenius theorem in Spain). Let
n be the number of variables in the system, and
consider the matrix equation.
■ If 𝑟𝑎𝑛𝑘 𝐴 ≠ 𝑟𝑎𝑛𝑘 𝐴 𝑏 the system is inconsistent
■ If 𝑟𝑎𝑛𝑘 𝐴 = 𝑟𝑎𝑛𝑘 𝐴 𝑏 = 𝑛 the system is
determined (finite number of solutions)
■ If 𝑟𝑎𝑛𝑘 𝐴 = 𝑟𝑎𝑛𝑘 𝐴 𝑏 ≠ 𝑛 the system is
undetermined (infinite solutions)
27
Systems of linear equations
Cramer’s Rule
■ Suppose the system is the following one. We are going to use
the matrix format:
𝑎𝑥 + 𝑏𝑦 + 𝑐𝑧 = 𝑙 𝑎 𝑏 𝑐 𝑥 𝑙
`𝑑𝑥 + 𝑒𝑦 + 𝑓𝑧 = 𝑚 → 𝑑 𝑒 𝑓 𝑦 = 𝑚
𝑔𝑥 + ℎ𝑦 + 𝑘𝑧 = 𝑛 𝑔 ℎ 𝑘 𝑧 𝑛

■ The solutions of this system of linear equations are:


𝑙 𝑏 𝑐 𝑎 𝑙 𝑐 𝑎 𝑏 𝑙
𝑚 𝑒 𝑓 𝑑 𝑚 𝑓 𝑑 𝑒 𝑚
𝑔 𝑛 𝑘 𝑔 ℎ 𝑛
𝑥 = 𝑛 ℎ 𝑘 ,𝑦 = ,𝑧=
|𝐴| |𝐴| |𝐴|
■ In case our system is homogeneous (all the entries in vector b
are equal to zero), it will always be consistent and, in case it is
determined, the only solution is the trivial one (all variables
equal to zero). 28

You might also like