Dot Product in LaTeX

Write the dot product with \cdot between two vectors in math mode: \mathbf{u} \cdot \mathbf{v} or \vec{u} \cdot \vec{v}. For inner-product notation use angle brackets \langle \mathbf{u}, \mathbf{v} \rangle, not the less-than and greater-than keys.

Dot product notation

  • \mathbf{u} \cdot \mathbf{v}
    u ⋅ v

    Bold vectors with a centered dot.

  • \vec{u} \cdot \vec{v}
    u → ⋅ v →

    Arrow vectors with a centered dot.

  • \langle \mathbf{u}, \mathbf{v} \rangle
    ⟨ u , v ⟩

    Inner-product (angle bracket) notation.

  • \mathbf{u}^\top \mathbf{v}
    u ⊤ v

    Matrix form: row vector times column vector.

  • \|\mathbf{u}\|
    ∥ u ∥

    Length (norm) of a vector, used with the dot product.

  • \sum_{i=1}^{n} u_i v_i
    ∑ i = 1 n u i v i

    Component form.

  • \boldsymbol{\alpha} \cdot \boldsymbol{\beta}
    α ⋅ β

    Bold Greek vectors need \boldsymbol (amsmath), not \mathbf.

Try it live

Change the formula and the preview redraws as you type. Copy the LaTeX, download a PNG or SVG, copy it for Word, or use Edit here on any example below to load it.

Templates

Dot product examples

Each result below is drawn from the LaTeX under it. Copy the code, edit it on this page, or open it in the full editor.

  • Definition

    a ⋅ b = ∑ i = 1 n a i b i
    LaTeX
    \mathbf{a} \cdot \mathbf{b} = \sum_{i=1}^{n} a_i b_i
  • In three dimensions

    a ⋅ b = a 1 b 1 + a 2 b 2 + a 3 b 3
    LaTeX
    \mathbf{a} \cdot \mathbf{b} = a_1 b_1 + a_2 b_2 + a_3 b_3
  • With numbers

    ( 1 , 2 , 3 ) ⋅ ( 4 , 5 , 6 ) = 4 + 10 + 18 = 32
    LaTeX
    (1, 2, 3) \cdot (4, 5, 6) = 4 + 10 + 18 = 32
  • Geometric form

    a ⋅ b = ∥ a ∥ ∥ b ∥ cos ⁡ θ
    LaTeX
    \mathbf{a} \cdot \mathbf{b} = \|\mathbf{a}\| \, \|\mathbf{b}\| \cos\theta
  • Angle between vectors

    cos ⁡ θ = u → ⋅ v → ∥ u → ∥ ∥ v → ∥
    LaTeX
    \cos\theta = \frac{\vec{u} \cdot \vec{v}}{\|\vec{u}\| \, \|\vec{v}\|}
  • Orthogonality

    u → ⋅ v → = 0 ⟺ u → ⊥ v →
    LaTeX
    \vec{u} \cdot \vec{v} = 0 \iff \vec{u} \perp \vec{v}
  • Inner product of functions

    ⟨ f , g ⟩ = ∫ a b f ( x ) g ( x ) d x
    LaTeX
    \langle f, g \rangle = \int_{a}^{b} f(x) \, g(x) \, dx

Which dot to use

\cdot is a binary operator: it sits at mid-height and gets space on both sides, which is what a dot product needs. A period . sits on the baseline with no spacing, and \bullet is a heavy round dot that looks out of place between vectors.

Angle brackets for inner products

Use \langle and \rangle for ⟨ ⟩. The keyboard < and > are relations: they are the wrong shape and LaTeX spaces them as comparisons. For tall contents, \left\langle … \right\rangle stretches the brackets.

Writing the vectors

Choose one vector style and keep it: \vec{u} (arrow), \mathbf{u} (upright bold, common in print) or \boldsymbol{u} (bold italic). \mathbf does not work on Greek letters; use \boldsymbol{\alpha} from amsmath (or \bm from the bm package in LaTeX).

Common mistakes

  • < and > are comparison signs with relation spacing, not brackets.

    Instead of
    <u, v>
    Write
    \langle u, v \rangle
  • A period sits on the baseline and gets no operator spacing.

    Instead of
    u.v
    Write
    u \cdot v
  • \mathbf leaves lowercase Greek letters unchanged, so the vectors do not look bold.

    Instead of
    \mathbf{\alpha} \cdot \mathbf{\beta}
    Write
    \boldsymbol{\alpha} \cdot \boldsymbol{\beta}
  • Two single bars are spaced as separate symbols; \| is the norm delimiter.

    Instead of
    ||u||
    Write
    \|u\|

In Overleaf, MathJax and Word

  • Overleaf and pdfLaTeX

    \cdot, \vec, \mathbf, \langle, \rangle and \| are built in; \boldsymbol needs amsmath, \bm needs the bm package.

  • MathJax and KaTeX

    MathJax and KaTeX support all the notation above, including \boldsymbol. \bm is not available in MathJax by default, so prefer \boldsymbol for text that will be shown on the web.

  • Microsoft Word

    Write the formula in the editor on this page and use Copy for Word: the vectors, dot and brackets paste as an editable Word equation.

Dot product in LaTeX: questions

What is the LaTeX command for the dot product?
\cdot, placed between the vectors in math mode: $\mathbf{u} \cdot \mathbf{v}$.
How do I write ⟨u, v⟩ in LaTeX?
Use \langle u, v \rangle. For larger contents, \left\langle … \right\rangle scales the brackets.
How do I write vectors with arrows in a dot product?
Use \vec{u} \cdot \vec{v}. For an arrow over two letters, such as AB, use \overrightarrow{AB}.
Should I use \cdot or \bullet?
\cdot. It is the standard dot-product symbol; \bullet is a larger dot that is rarely used for products.

Have the formula as a picture?

Paste a screenshot or photo of the equation and get its LaTeX, ready to copy or open in the editor.

Convert an image to LaTeX