DIM_2 makeMatrix(randRange(-2, 5, DIM_1, DIM_2)) makeMatrix(randRange(-2, 5, DIM_3, DIM_4)) matrixMult(MAT_1, MAT_2) matrixPad(SOLN_MAT, 3, 3) "\\textbf " + randFromArray("ABCDEF") "\\textbf " + randFromArray("ABCDEF") [GREEN, BLUE, GRAY] [ORANGE, "#DF0030", "#9D38BD"] makeMultHintMatrix(MAT_1, MAT_2, ROW_COLORS, COL_COLORS) $._("row") $._("column")

PRETTY_MAT_1_ID = printSimpleMatrix(MAT_1)

PRETTY_MAT_2_ID = printSimpleMatrix(MAT_2)

What is PRETTY_MAT_1_ID + PRETTY_MAT_2_ID?

Because PRETTY_MAT_1_ID has dimensions (DIM_1 + "\\times" + DIM_2) and PRETTY_MAT_2_ID has dimensions (DIM_3 + "\\times" + DIM_4), the answer matrix will have dimensions (DIM_1 + "\\times" + DIM_4).

PRETTY_MAT_1_ID + PRETTY_MAT_2_ID = printColoredDimMatrix(MAT_1, ROW_COLORS, true) printColoredDimMatrix(MAT_2, COL_COLORS, false) = printSimpleMatrix(maskMatrix(FINAL_HINT_MAT, []))

To find the element at any row i, column j of the answer matrix, multiply the elements in row i of the first matrix, PRETTY_MAT_1_ID, with the corresponding elements in column j of the second matrix, PRETTY_MAT_2_ID, and add the products together.

So, to find the element at row 1, column 1 of the answer matrix, multiply the first element in colorMarkup("\\text{" + ROW + " }1", ROW_COLORS[0]) of PRETTY_MAT_1_ID with the first element in colorMarkup("\\text{" + COLUMN + " }1", COL_COLORS[0]) of PRETTY_MAT_2_ID, then multiply the second element in colorMarkup("\\text{" + ROW + " }1", ROW_COLORS[0]) of PRETTY_MAT_1_ID with the second element in colorMarkup("\\text{" + COLUMN + " }1", COL_COLORS[0]) of PRETTY_MAT_2_ID, and so on. Add the products together.

printSimpleMatrix( maskMatrix(FINAL_HINT_MAT, [[1, 1]]) )

Likewise, to find the element at row 2, column 1 of the answer matrix, multiply the elements in colorMarkup("\\text{" + ROW + " }2", ROW_COLORS[1]) of PRETTY_MAT_1_ID with the corresponding elements in colorMarkup("\\text{" + COLUMN + " }1", COL_COLORS[0]) of PRETTY_MAT_2_ID and add the products together.

printSimpleMatrix( maskMatrix(FINAL_HINT_MAT, [[1, 1], [2, 1]]) )

Likewise, to find the element at row 1, column 2 of the answer matrix, multiply the elements in colorMarkup("\\text{" + ROW + " }1", ROW_COLORS[0]) of PRETTY_MAT_1_ID with the corresponding elements in colorMarkup("\\text{" + COLUMN + " }2", COL_COLORS[1]) of PRETTY_MAT_2_ID and add the products together.

printSimpleMatrix( maskMatrix(FINAL_HINT_MAT, [[1, 1], [2, 1], [1, 2]]) )

Fill out the rest:

printSimpleMatrix(FINAL_HINT_MAT)

After simplifying, we end up with:

printSimpleMatrix(SOLN_MAT)
elem elem
2 2 2
2 3 2
2 2 3
3 1 2
3 2 2