In mathematics, there are two vector operations called scalar product (or dot product) and vector product (or cross product). These operations are used all throughout not just mathematics, but physics, engineering, and STEM fields as a collective. Let's start off with scalar product.
Imagine you have two 3D vectors, $ \vec{A} $ and $ \vec{B} $. Now, say you want to find "how close" these vectors are to being aligned with one another. Then what we can do is take what's called the scalar product of the vectors. This can be written as
[ 1 ]
$$ \vec{A} • \vec{B} = A_xB_x + A_yB_y + A_zB_z $$
You may be wondering why it is we only multiply the same vector components such as $ A_x $ and $ B_x $ together and not mixed components such as $ A_z $ and $ B_y $? Well that is because with a scalar product, we are trying to find out how much the two vectors are pointing in the same direction, hence, it wouldn't help us to look at mixed cases because they are not in the same direction!
We can also write a dot product as so:
[ 2 ]
$$ \vec{A} • \vec{B} = A B \cos{\theta} $$
This then allows us to relate the vectors with the angle $ \theta $ between them. We can take Eq. (1) and Eq. (2) and then combine them to get
[ 3 ]
$$ A_xB_x + A_yB_y + A_zB_z = A B \cos{\theta} $$
Dot product will always produce a scalar value, and if two vectors are perpendicular to one another, the dot product will return zero. Remember a scalar product is a measure of how aligned two vectors are, so if they are perpendicular, then they have no alignment, hence, the scalar product will equal zero.
The next vector operation we are going to learn about is vector product. Imagine we have the same two vectors from before, $ \vec{A} $ and $ \vec{B} $. Now let's say we would like to find a vector that is perpendicular to both $ \vec{A} $ and $ \vec{B} $. Well then we can do what's called a cross product!
[ 4 ]
$$ \vec{A} \times \vec{B} = \begin{bmatrix} \hat{i} & \hat{j} & \hat{k} \\ A_x & A_y & A_z \\ B_x & B_y & B_z \end{bmatrix} $$ $$ \Rightarrow \hat{i} (A_yB_z - B_yA_z) - \hat{j} (A_xB_z - A_zB_x) + \hat{k} (A_xB_y - B_xA_y) $$
Notice how cross product produces a vector, and it will be perpendicular to both $ \vec{A} $ and $ \vec{B} $!