In math, dot symbols (•) are often used for multiplication, especially for dot products with vectors. In this guide, we will learn how to show these symbols in LaTeX.
Dot product syntax
To show a dot product between two vectors in LaTeX, use the \cdot
command. This command makes a small dot.
\[ \vec{p} \cdot \vec{q} \]
Output :
When you compile this code, you will see two vectors with a dot between them. The \vec{}
command adds an arrow on top of the letter to show that it is a vector.
If you do not want to use arrows, you can make the vectors bold instead. Use the \textbf{}
command like this:
\[ \textbf{p} \cdot \textbf{q} \]
Output :
This is another way to show vectors. You can choose the style that you need for your document.
Product in the form of cosθ
The product of two vectors can also be written in terms of the angle between them. Use both \cos and \theta commands to show the cosine symbol and the angle symbol.
\[ \vec{p} \cdot \vec{q}=\left | \vec{p} \right |\left | \vec{q} \right |\cos\theta \]
Output :
Notice the use of \left|
and \right|
commands. These create vertical bars that show the absolute value (or magnitude) of a vector.
Using position vector
If you know the position of two vectors, you can write their dot product using their components. Here is how to define position vectors in LaTeX:
\[ \vec{p}=(x_{1}\hat{i}+y_{1}\hat{i}+z_{1}\hat{i}) \]
\[ \vec{q}=(x_{2}\hat{i}+y_{2}\hat{i}+z_{2}\hat{i}) \]
\[ \vec{p}\cdot\vec{q}=x_{1}x_{2}+y_{1}y_{2}+z_{1}z_{2} \]
Output :
In the above code, a unit vector is shown with a hat symbol. The \hat{}
command adds a small hat on the letter (like i, j, or k).
Vector matrix product
Sometimes, dot products are written using matrices. One vector is shown as a row matrix and the other as a column matrix.
\[ \vec{p}\cdot\vec{q}=
\begin{pmatrix} x_{1} & y_{1} & z_{1} \end{pmatrix}
\begin{pmatrix} x_{2}\\ y_{2}\\ z_{2} \end{pmatrix} \]
Output :
Vector triple product
Sometimes, you will see a triple product that uses both dot and cross products. For example:
\[ \vec{a}\cdot(\vec{b}\times\vec{c}\,) \]
Output :
For the cross product, use the \times
command. The \,
command adds a small space before the closing bracket.