How to write a dot product in LaTeX

How to write a dot product in LaTeX

This post may contain affiliate links that allow us to earn a commission at no expense to you. Learn more

This article aims to show you a simple way to create a dot symbol in LaTeX.

In physics and mathematics most of the time when you are working with vectors you will need to calculate the dot product of two vectors. That’s why today you will learn how to write the dot product in LaTeX

Dot Product

Let’s begin with two vectors A and B, the dot product is defined as the multiplication of two given vectors that results in a positive real number also known as scalar. That means that you get a number rather than a vector. 

The dot product of A and B is represent with a dot symbol between both vectors, for example

dot product in LaTeX
Multiplication dot symbol, a single point

Dot Operator Symbol in LaTeX

To write the dot operator symbol, you will need the math mode and one simple command, the \cdot command, and as you can see it does not need arguments. Since the command is already in LaTeX, you don’t need any extra package for it. 

Let’s say we have to vectors U and V, the dot product will be

\documentclass{article}
\begin{document}
  $$\vec{U} \cdot \vec{V}$$
\end{document}
dot product in LaTeX
\cdot command output

One variation that you could need, is the vectors with bold font and with the arrow mark, once again without packages.

\documentclass{article}
\begin{document}
  $$\vec{\mathbf{U}} \cdot \vec{\mathbf{V}}$$
\end{document}
dot product in LaTeX
Bold symbols with the dot product character

Dot product Angle/Vector/Matrix form

Now the dot product between two vectors can have 3 main representations, each one can be used depending on the context, and they can be inserted in LaTeX. Below you will have examples for each one of them.

The first form (Angle Form) involves the angle theta between the vectors, therefore you will need the \theta command and the symbol for the norm of the vector, all of them must be inside the math mode. For example, given R and B the dot product in angle form would be,

\begin{document}
$$\vec{R} \cdot \vec{B} = \Vert\vec{R}\Vert \Vert\vec{B}\Vert \cos(\theta)$$
\end{document}

Gives the output

dot product in LaTeX

The second form (Vector Form) is more used when you know each component of two vectors with the same size, it is pretty common in physics to multiply two vectors using this form. Requires the math mode.

\documentclass{article}
\begin{document}
    $$\vec{a}=(x_{1}\hat{i}+y_{1}\hat{i}+z_{1}\hat{i})$$
    $$\vec{b}=(x_{2}\hat{i}+y_{2}\hat{i}+z_{2}\hat{i})$$
    \vspace{2pt}
    $$\vec{a}\cdot\vec{b}=x_{1}x_{2}+y_{1}y_{2}+z_{1}z_{2}$$
\end{document}

Gives the output

dot product in LaTeX

The third and last form (Matrix Form) is more common in linear algebra, when you are working with vectors. You will need to use the pmatrix (math mode required) environment, and \\ and & for the rows and columns, let’s see it in an example

\documentclass{article}
\usepackage{amsmath}
\begin{document}
    Given $\vec{R}$ and $\vec{B}$, the dot product is defined as
    $$\vec{R}\cdot\vec{B}=\begin{pmatrix} x_{1} & y_{1} & z_{1}
    \end{pmatrix}
    \begin{pmatrix} x_{2}\\ y_{2}\\ z_{2} \end{pmatrix}$$
\end{document}

We use & to determine the position of each new column, and \\ for the position of each row or line. The only thing to take notice of is the need of the amsmath package for the pmatrix environment, but usually this package does not have any trouble with compatibility with other packages. The code above gives the output

dot product in LaTeX
The result would be represented after multiplying both matrices, and adding their values. 

Triple Vector product

Given three vectors A, B and C you can perform what it is called, the triple vector product. It involves the dot product operation and the vector product operation. 

The triple vector product is defined as

\begin{document}
$\vec{A}\cdot(\vec{B}\times\vec{C}\,)$
\end{document}
dot product in LaTeX
Triple vector product

The result of the triple product vector is a scalar number, but in this case, it represents the area of a geometrical figure.

Now you know how to insert the dot symbols used for the dot product in your LaTeX documents, and some forms you may encounter in textbooks. Maybe you already notice it but it is just the normal multiplication sign

I hope this tutorial was helpful in guiding you in LaTeX, and as always keep writing in LaTeX


Further Reading

LaTex Tutorial on Symbols

  1. How To Create A Cross Product Symbol In LaTeX
  2. How to create a hat symbol in LaTeX?
  3. How to create a prime symbol in LaTeX?
  4. How to create an absolute value symbol in LaTeX?
  5. How to create an approximate symbol in LaTeX?
  6. How to create an intersection symbol in LaTeX?
  7. How to create the empty set symbol in LaTeX?
  8. How to write a degree symbol in LaTeX?
  9. How to Write a Greater Than Symbol in LaTeX?
  10. How to write a norm symbol in LaTeX?
  11. How to write A Plus-Minus Symbol in LaTeX
  12. How to write a proportional to symbol in LaTeX?
  13. How to write a real number symbol in LaTeX?
  14. How to write a tilde symbol in LaTeX?
  15. How to write a union symbol in LaTeX?
  16. How to write a vector in LaTeX?
  17. How to write an infinity symbol in LaTeX?
  18. How to write bold text in LaTeX?
  19. How To Write Dots Symbols In LaTeX?
  20. How to write the arrow symbols in LaTeX
  21. How to write the Degree celsius symbol in LaTeX?
  22. How to write the equal or not equal symbol in LaTeX?
  23. How to write the Euro symbol in LaTeX?
  24. How to write the floor symbol in LaTeX?
  25. How to write the gradient operator symbol in LaTeX
  26. How To Write The Greater Than Or Equal To Symbol In LaTeX?
  27. How to write the integer number symbol in LaTeX?
  28. How to write the less than symbol in LaTeX?
  29. How to write the Natural numbers symbol in LaTeX?
  30. How to write the parallel symbol in LaTeX?
  31. How to write the percent symbol in LaTeX?
  32. How to write the square root symbol in LaTeX?
  33. How To Write The Symbol For A Subset In LaTeX?
  34. How to write the symbol for therefore in LaTeX?
  35. How to write with the mathbb in LaTeX?

Photo of author
Author
SJ Tsai
Chief Editor. Writer wrangler. Research guru. Three years at scijournal. Hails from a family with five PhDs. When not shaping content, creates art. Peek at the collection on Etsy. For thoughts and updates, hit up Twitter.

Leave a Comment