randRange(0, 10) randRange(0, 10) A * B
\Huge\blue{A}\times\green{B}=\pink?
C

Let's picture this problem by drawing \green{B} rows of \blue{A} circles.

init({ range: [[-1, 12], [-2.5, B - 2.5]], scale: [45, 45] }); for (var i = 0; i < B; i++) { drawRow(A, B - 3 - i, BLACK, A * i + 1); }

How many circles are there?

If we have \green{B} zeros, how much do we have in total?
If we have \blue{A} zeros, how much do we have in total?
If we have one \green{B}, how much do we have in total?
If we have one \blue{A}, how much do we have in total?
\Huge\blue{A}\times\green{B}=\pink{C}
randRange(1, 10) randRange(0, 10) A * B rand(2)
\Huge\blue{A}\times\green{?}=\pink{C}
\Huge\green{?}\times\blue{A}=\pink{C}
B

How many rows of \blue{A} circles do we need to make \pink{C} total circles?

init({ range: [[-1, 12], [-2.5, B - 2.5]], scale: [45, 45] }); for (var i = 0; i < B; i++) { drawRow(A, B - 3 - i, BLACK, A * i + 1); }

We need \green{B} rows of \blue{A} circles to make \pink{C} total circles.

What times \blue{A} equals zero?
What can we multiply by \blue{A} to get \pink{C}?
\Huge\blue{A}\times\green{B}=\pink{C}
\Huge\green{B}\times\blue{A}=\pink{C}