Answer
If the magnitude of $a$ that is, $|a|$ and the magnitude of $b$ that is, $|b|$ is known and the angle between $a$ and $b$ that is, $\theta$ is to be known, the product of the magnitudes and the cosine of the angle is the dot product of $a$ and $b$.
$a \cdot b= |a| |b| cos \theta$
If the components of $a$ and $b$ are known, the dot product of $a$ and $b$ is simply the sum of the products of corresponding component parts.
This implies that
$(a_1+a_2)i \cdot (b_1+b_2)j = a_1b_1+a_2b_2$
Work Step by Step
If the magnitude of $a$ that is, $|a|$ and the magnitude of $b$ that is, $|b|$ is known and the angle between $a$ and $b$ that is, $\theta$ is to be known, the product of the magnitudes and the cosine of the angle is the dot product of $a$ and $b$.
$a \cdot b= |a| |b| cos \theta$
If the components of $a$ and $b$ are known, the dot product of $a$ and $b$ is simply the sum of the products of corresponding component parts.
This implies that
$(a_1+a_2)i \cdot (b_1+b_2)j = a_1b_1+a_2b_2$