The dot product, also known as the scalar product or inner product, is a fundamental operation in linear algebra and physics. It takes two vectors as input and produces a scalar output. The dot product represents the projection of one vector onto another and gives the magnitude of that projected component.
In LaTeX, the dot product is denoted with a centered dot "\cdot" between the two vector inputs. While simple in appearance, properly using and formatting the dot product requires some LaTeX formatting knowledge. In this comprehensive guide, we will cover everything you need to know to write and use dot products effectively in your LaTeX documents.
Dot Product Basics
Before jumping into LaTeX syntax, let‘s review some dot product fundamentals.
The dot product between two vectors $\vec{a}$ and $\vec{b}$ can be defined as:
$$ \vec{a} \cdot \vec{b} = ab\cos{\theta} $$
Where $a$ and $b$ are the magnitudes of the vectors and $\theta$ is the angle between them.
Geometrically, this can be interpreted as projecting one vector onto another. The result gives the magnitude of $\vec{a}$‘s component that points in the same direction as $\vec{b}$.
Some key properties of the dot product:
 Commutative: $\vec{a} \cdot \vec{b} = \vec{b} \cdot \vec{a}$
 Distributive over vector addition
 Equals zero for orthogonal vectors
These properties make the dot product extremely useful in physics and engineering applications.
Writing a Dot Product in LaTeX
LaTeX provides an easy way to write a dot product using standard math mode syntax:
$\vec{a} \cdot \vec{b}$
Which renders as:
$\vec{a} \cdot \vec{b}$
The centered dot \cdot
is sandwiched between the two vector inputs.
Let‘s look at some more complete examples:
\documentclass{article}
\begin{document}
The dot product between two vectors $\vec{a}$ and $\vec{b}$ is:
$\vec{a} \cdot \vec{b} = a_{x} b_{x} + a_{y} b_{y} + a_{z} b_{z}$
\end{document}
Renders as:
The dot product between two vectors $\vec{a}$ and $\vec{b}$ is:
$\vec{a} \cdot \vec{b} = a{x} b{x} + a{y} b{y} + a{z} b{z}$
We can also use bold vector notation:
\documentclass{article}
\begin{document}
$\mathbf{a} \cdot \mathbf{b} = \mathbf{a} \mathbf{b} \cos{\theta}$
\end{document}
Renders as:
$\mathbf{a} \cdot \mathbf{b} = \mathbf{a} \mathbf{b} \cos{\theta}$
Where the bold font indicates vector quantities.
Using Dot Products in Equations
A common use case for dot products is in vector calculus equations. For example, calculating the divergence of a vector field $\mathbf{F}$:
\documentclass{article}
\begin{document}
$\nabla \cdot \mathbf{F} = \frac{\partial F_{x}}{\partial x} + \frac{\partial F_{y}}{\partial y} + \frac{\partial F_{z}}{\partial z}$
\end{document}
Renders as:
$\nabla \cdot \mathbf{F} = \frac{\partial F{x}}{\partial x} + \frac{\partial F{y}}{\partial y} + \frac{\partial F_{z}}{\partial z}$
Here the divergence operator $\nabla \cdot$ represents the dot product between $\nabla$, the del operator, and the vector field $\mathbf{F}$.
We can also use dot products to represent the projection of one vector onto another. For example, decomposing vector b into components parallel and perpendicular to a:
\documentclass{article}
\begin{document}
$\mathbf{b}_{} = (\mathbf{b} \cdot \hat{\mathbf{a}}) \hat{\mathbf{a}}$
$\mathbf{b}_{\perp} = \mathbf{b}  \mathbf{b}_{}$
\end{document}
Renders as:
$\mathbf{b}_{} = (\mathbf{b} \cdot \hat{\mathbf{a}}) \hat{\mathbf{a}}$
$\mathbf{b}{\perp} = \mathbf{b} – \mathbf{b}{}$
Where $\hat{\mathbf{a}}$ is the unit vector in the a direction. This leverages dot products and vector algebra to decompose b into its parallel and orthogonal parts relative to a.
As you can see, dot products are ubiquitous in vector calculus and physics applications. LaTeX allows representing them in a simple and consistent format.
Multiline Dot Products
For longer equations, we may want to split the dot product over multiple lines. There are two easy ways to accomplish this in LaTeX:
1. Use split environment:
\documentclass{article}
\begin{document}
\begin{equation}
\begin{split}
\mathbf{a} \cdot \mathbf{b} &= a_{x} b_{x} + a_{y} b_{y} + a_{z} b_{z} \\
&= ab\cos{\theta}
\end{split}
\end{equation}
\end{document}
Which renders as:
\begin{equation}
\begin{split}
\mathbf{a} \cdot \mathbf{b} &= a{x} b{x} + a{y} b{y} + a{z} b{z} \
&= ab\cos{\theta}
\end{split}
\end{equation}
2. Use aligned environment:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
\begin{aligned}
\mathbf{a} \cdot \mathbf{b} &= a_{1}b_{1} + a_{2}b_{2} + a_{3}b_{3} \\
&= ab\cos{\theta}
\end{aligned}
\end{equation}
\end{document}
Renders as:
\begin{equation}
\begin{aligned}
\mathbf{a} \cdot \mathbf{b} &= a{1}b{1} + a{2}b{2} + a{3}b{3} \
&= ab\cos{\theta}
\end{aligned}
\end{equation}
Both environments allow splitting equations over multiple lines while maintaining proper alignment and spacing.
Dot Products of Matrices
The dot product operation can also be applied to matrices. This corresponds to the matrix multiplication operation. For example:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
$\begin{bmatrix} a & b \\ c & d \end{bmatrix}
\cdot
\begin{bmatrix} w \\ x \end{bmatrix}
= \begin{bmatrix} aw + bx \\ cw + dx \end{bmatrix}$
\end{document}
Renders as:
$\begin{bmatrix} a & b \ c & d \end{bmatrix}
\cdot
\begin{bmatrix} w \ x \end{bmatrix}
= \begin{bmatrix} aw + bx \ cw + dx \end{bmatrix}$
Here we are multiplying a $2×2$ matrix by a $2×1$ column vector using dot product notation. This applies the standard rules of matrix multiplication.
In physics, dot products of matrices can represent transformations between coordinate systems. For example, tensor quantities that transform according to specialized coordination rules under dot multiplication.
Formatting Tips for Dot Products
Here are some handy formatting tips when working with dot products in LaTeX:

Use nonitalic vectors: Dot products work best with nonitalicized vectors. Use
\mathbf
or\vec
instead of native italic vectors. 
Add spacing around the dot: Put a small space
\
before and after the\cdot
for better readability. 
Use parentheses if needed: If the dot product involves complex terms, wrap them in parentheses for clarity.

Align split lines on dots: When splitting over multiple lines, align each row on the dot for easy visual scanning.

Use vector notation instead of matrices where possible: Dot products read much cleaner with explicit vector notation compared to matrices.
Adhering to these formatting guidelines will make your LaTeX dot products look more professional.
Advanced Dot Product Identity
Now that we have covered LaTeX dot product basics, let‘s look at a more advanced dot product identity.
A key expression in electromagnetic theory is the vector triple product expansion formula:
$\mathbf{a} \cdot (\mathbf{b} \times \mathbf{c}) = \mathbf{b}\cdot(\mathbf{c} \times \mathbf{a}) = \mathbf{c} \cdot (\mathbf{a} \times \mathbf{b})$
We can write this identity compactly by leveraging dot products:
\documentclass{article}
\begin{document}
$\vec{a} \cdot (\vec{b} \times \vec{c}) =
\vec{b} \cdot (\vec{c} \times \vec{a}) =
\vec{c} \cdot (\vec{a} \times \vec{b})$
\end{document}
Which renders as:
$\vec{a} \cdot (\vec{b} \times \vec{c}) =
\vec{b} \cdot (\vec{c} \times \vec{a}) =
\vec{c} \cdot (\vec{a} \times \vec{b})$
This shows the cyclic permutation property between the different vector pairings. Being able to correctly write identities like this is key for advanced physics and engineering applications.
Troubleshooting Dot Products
When working with LaTeX dot products, here are some common errors to look out for:

Missing package errors: Compile errors from missing packages like
amsmath
. Ensure you import necessary packages. 
Spacing issues: Too much or inconsistent spacing around
\cdot
or vectors. Stick to a uniform spacing style. 
Ambiguous parentheses: Unclear association for parentheses grouped terms. Use extra parentheses around complex terms.

Wrong environments: Trying to use alignment tools in incompatible environments. Stick to
split
,aligned
, etc for multiline equations.
Paying attention to formatting guidelines earlier can help avoid these LaTeX dot product pitfalls.
Conclusion
We have covered the fundamentals of writing and formatting dot products in LaTeX documents:

Use
\cdot
between vectors for the dot product symbol 
Employ in physics equations and vector calculus identities

Split across multiple lines using
split
oraligned
environments 
Apply between matrices for matrix multiplication

Adhere to spacing, parentheses, and other formatting guidelines
LaTeX handles dot products well and allows you to represent them exactly as written mathematically. Applying the tips in this guide will help you leverage dot products effectively in your own LaTeX documents.
As you advance your work in electromagnetism, quantum mechanics, vector calculus, and related areas – being able to clearly write dot products is essential. LaTeX provides the capabilities for this. So start using dot products today with modern LaTeX!