LatexNotes

Vectors in LaTeX

A vector is a quantity with direction and magnitude; in LaTeX it is marked with \vec (a small arrow), with bold type via \mathbf, or written out as a column with a one-column matrix.

LaTeX command

\vec{v}

Not the symbol you meant? Draw it to find the command →

Typing up handwritten notes? Convert a whole page of handwriting to LaTeX →

The direct command is \vec{v}, which draws a short arrow over a single symbol. Physics and engineering texts often prefer bold instead, using \mathbf{v} for an upright bold letter. Pure mathematics frequently uses no decoration at all and relies on context. Pick one convention and keep it consistent throughout a document.

A column vector is just a one-column matrix, so \begin{pmatrix} x \\ y \\ z \end{pmatrix} stacks the components. Row vectors use a single row with & between entries. For the displacement from A to B use \overrightarrow{AB}, and for a unit vector use a hat, as in \hat{\mathbf{n}} or \hat{\imath}.

Operations read naturally: \mathbf{a} \cdot \mathbf{b} is the dot (scalar) product and \mathbf{a} \times \mathbf{b} is the cross product. Note that \mathbf bolds Latin letters and uppercase Greek but not lowercase Greek; to bold a lowercase Greek symbol you need \boldsymbol, and the column-vector matrix environments require amsmath.

Other forms

\mathbf{v}bold vector
\begin{pmatrix} x \\ y \\ z \end{pmatrix}a column vector

Examples

$\vec{v} = \begin{pmatrix} 1 \\ 2 \\ 3 \end{pmatrix}$

an arrow-marked column vector

$\mathbf{a} \cdot \mathbf{b}$

a dot (scalar) product in bold notation

$\mathbf{a} \times \mathbf{b}$

a cross product

$\hat{\imath} + 2\hat{\jmath} - \hat{k}$

unit vectors with hats (\imath has no dot)

$\overrightarrow{AB} = \vec{b} - \vec{a}$

the displacement from A to B

Tips and common mistakes

Working from handwritten notes?

LatexNotes turns a photo or PDF of handwritten mathematics into LaTeX, graphs and all. It is built with real pdflatex before you see it, and the .tex file is yours to edit or take to Overleaf. Free to try, no sign-up.

See how handwriting to LaTeX works, step by step, or go from GoodNotes to LaTeX if you write on an iPad (Notability works the same way).

Convert your maths to LaTeX →

FAQ

How do I put an arrow over a vector in LaTeX?

Use \vec{v} for a single symbol. For a labelled segment spanning two letters, use \overrightarrow{AB}, which stretches the arrow across both.

How do I write a column vector?

Use a one-column matrix: \begin{pmatrix} x \\ y \\ z \end{pmatrix}. The \\ ends each row so the components stack vertically.

How do I make a bold vector?

Use \mathbf{v} for a bold upright Latin letter. For a bold Greek letter such as omega, use \boldsymbol{\omega} instead, since \mathbf does not affect lowercase Greek.

See also