PRETTY_MAT_1_ID = PRETTY_MAT_1
PRETTY_MAT_2_ID = PRETTY_MAT_2
Is PRETTY_MAT_1_ID + OPERATION + PRETTY_MAT_2_ID
defined?
ANSWER
In order for addition of two matrices to be defined, the matrices must have the same dimensions.
If PRETTY_MAT_1_ID
is of
dimension (\blue m \times \red n)
and
PRETTY_MAT_2_ID
is of
dimension (\blue p \times \red q)
,
then for their sum to be defined:
In order for subtraction of two matrices to be defined, the matrices must have the same dimensions.
If PRETTY_MAT_1_ID
is of
dimension (\blue m \times \red n)
and
PRETTY_MAT_2_ID
is of
dimension (\blue p \times \red q)
,
then for their difference to be defined:
1. \blue m
(number of rows in PRETTY_MAT_1_ID
) must equal \blue p
(number of rows in PRETTY_MAT_2_ID
) and
2. \red n
(number of columns in PRETTY_MAT_1_ID
) must equal \red q
(number of columns in PRETTY_MAT_2_ID
)
Do PRETTY_MAT_1_ID
and PRETTY_MAT_2_ID
have the same number of rows?
Do PRETTY_MAT_1_ID
and PRETTY_MAT_2_ID
have the same number of columns?
Since PRETTY_MAT_1_ID
has
the same dimensions
(DIM_1 + "\\times" + DIM_2)
as
PRETTY_MAT_2_ID
(DIM_3 + "\\times" + DIM_4)
,
PRETTY_MAT_1_ID + OPERATION + PRETTY_MAT_2_ID
is defined.
Since PRETTY_MAT_1_ID
has
different dimensions
(DIM_1 + "\\times" + DIM_2)
from
PRETTY_MAT_2_ID
(DIM_3 + "\\times" + DIM_4)
,
PRETTY_MAT_1_ID + OPERATION + PRETTY_MAT_2_ID
is not defined.
In order for multiplication of two matrices to be defined, the two inner dimensions must be equal.
If the two matrices have dimensions (\blue m \times \red n)
and (\red p \times \green q)
, then \red n
(number of columns in the first matrix) must equal \red p
(number of rows in the second matrix) for their product to be defined.
How many columns does the first matrix, PRETTY_MAT_1_ID
, have?
How many rows does the second matrix, PRETTY_MAT_2_ID
, have?
PRETTY_MAT_1_ID
has the same
number of columns (DIM_2) as
PRETTY_MAT_2_ID
has rows
(DIM_3),
PRETTY_MAT_1_ID + PRETTY_MAT_2_ID
is defined.
PRETTY_MAT_1_ID
has a
different number of columns
(DIM_2) than
PRETTY_MAT_2_ID
has rows
(DIM_3),
PRETTY_MAT_1_ID + PRETTY_MAT_2_ID
is not defined.