Matthew S. answered 02/25/20
PhD in Mathematics with extensive experience teaching Linear Algebra
Yes, p = 2 and q = 5. To form the product AB, matrix B must have 2 rows (equalling the number of columns of A).
To form the product BC, matrix B must have 5 columns (equalling the number of rows of C). You can see this as follows: when you compute the i,j element of matrix BC you will multiply the first element of B's row i times the first element of C's column j. Then the second element of B's row i (which is in the second column of B) times the second element of C's column j (which is the second row of C). Separate the terms by a plus sign, of course, and so on. As you continue, you're grabbing one element from each column of B and you're grabbing one element from each row of C. If you run out of elements from one before the other, that wouldn't make sense. Therefore #columns of B must equal #rows of C.
Cayyy A.
Thank you so much for the assistance, it was so helpful.02/25/20