latex

How To Write and Use a Dot Product in LaTeX

The dot product represents the value of a force vector acting in the direction of the specific motion vector. It is also known as the “scalar product”, which states that the resulting result is a scalar, not a vector.

LaTeX also supports the dot product symbol as it plays an essential role in physics and mathematics. However, many users still are confused about how to write a dot product in LaTeX. So, let’s start a tutorial to explain the methods to write and use a dot product in LaTeX.

How To Write and Use a Dot Product in LaTeX

LaTeX does not require any external packages for writing the dot product. You only need to use the \cdot code as we did in the following source code:

\documentclass{article}
\begin{document}
$$\vec{X} \cdot \vec{Y}$$
\end{document}

Output

Similarly, you can write the dot product using bold font, and here is a simple example of it:

\documentclass{article}
\begin{document}
$$ \vec{\mathbf{X}} \cdot \vec{\mathbf{Y}}$$
\end{document}

Output

Dot Product in Different Forms in LaTeX

You can represent dot products in many other ways and use them per the requirements. So, let’s take a look at the following examples and usages of the different types of dot products:

1. Dot Product in Matrix Form

To use dot products in LaTeX with matrix, please use the pmatrix environment with the amsmath package in math mode. Moreover, use & and \\ for columns and rows, respectively:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
  $$
     \begin{bmatrix}
         a & b\\
         c & d
     \end{bmatrix}
     \cdot
     \begin{bmatrix}
         x \\
         y
     \end{bmatrix}
      =
     \begin{bmatrix}
         ax + by\\
         cx + dy  
     \end{bmatrix}
  $$
\end{document}

Output

2. Dot Product in Vector Form

In physics, multiplying two vectors is a common calculation when you know both vectors have the same value and components. Suppose we have two vectors, U and V. The dot product of these two vectors will not be a vector but a positive real number, also called a scalar. In the previous two vectors, the dot product will be as follows:

\documentclass{article}
\begin{document}
    $$\vec{X}=(a_{1}\hat{i}+b_{1}\hat{i}+c_{1}\hat{i})$$
    $$\vec{Y}=(a_{2}\hat{i}+b_{2}\hat{i}+c_{2}\hat{i})$$
    \vspace{2pt}
    $$\vec{X}\cdot\vec{Y}=a_{1}a_{2}+b_{1}b_{2}+c_{1}c_{2}$$
\end{document}

Output

3. Dot Product in Angle Form

Dot product also includes the angle theta(θ) between vectors. For example, let’s represent the relation between vectors A and B using the following source code:

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

Output

Conclusion

This tutorial briefly explained the methods to write and use a dot product in LaTeX. The dot product is used with vectors, matrices, etc. That’s why many mathematical expressions require a dot product to represent the relation between quantities. Our official website provides more information about LaTeX symbols.

About the author

Prateek Jangid

A passionate Linux user for personal and professional reasons, always exploring what is new in the world of Linux and sharing with my readers.