# Vectors in space

> Two vectors in the xy-plane, the parallelogram they span, and their cross product. A tikz-3dplot example with its LaTeX source.

A tikz-3dplot example in the TeXeR TikZ library: https://texer.org/library/tikz-3dplot/cross-product

Package: [tikz-3dplot](https://texer.org/library/tikz-3dplot.md), on CTAN at https://ctan.org/pkg/tikz-3dplot.

Tags: vectors, cross product, linear algebra, 3D

## Source

```latex
\usepackage{tikz-3dplot}
\usetikzlibrary{arrows.meta}

\tdplotsetmaincoords{65}{115}
\begin{tikzpicture}[tdplot_main_coords, scale=1.5, >={Stealth}]
  \fill[blue!12] (0,0,0) -- (1.6,0.3,0) -- (2,1.8,0) -- (0.4,1.5,0) -- cycle;
  \draw[->] (0,0,0) -- (2.4,0,0) node[anchor=north east] {$x$};
  \draw[->] (0,0,0) -- (0,2.4,0) node[anchor=north west] {$y$};
  \draw[->] (0,0,0) -- (0,0,2.6) node[anchor=south] {$z$};
  \draw[->, very thick, blue!70!black] (0,0,0) -- (1.6,0.3,0) node[anchor=north] {$\mathbf{a}$};
  \draw[->, very thick, red!70!black] (0,0,0) -- (0.4,1.5,0) node[anchor=west] {$\mathbf{b}$};
  \draw[->, very thick, green!50!black] (0,0,0) -- (0,0,2.2) node[anchor=east] {$\mathbf{a} \times \mathbf{b}$};
\end{tikzpicture}
```

## As a complete document

The same example in a document that compiles on its own with pdfLaTeX:

```latex
\documentclass[margin=3mm]{standalone}
\usepackage{tikz}
\usepackage{xcolor}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz-3dplot}
\usetikzlibrary{arrows.meta}

\begin{document}

\tdplotsetmaincoords{65}{115}
\begin{tikzpicture}[tdplot_main_coords, scale=1.5, >={Stealth}]
  \fill[blue!12] (0,0,0) -- (1.6,0.3,0) -- (2,1.8,0) -- (0.4,1.5,0) -- cycle;
  \draw[->] (0,0,0) -- (2.4,0,0) node[anchor=north east] {$x$};
  \draw[->] (0,0,0) -- (0,2.4,0) node[anchor=north west] {$y$};
  \draw[->] (0,0,0) -- (0,0,2.6) node[anchor=south] {$z$};
  \draw[->, very thick, blue!70!black] (0,0,0) -- (1.6,0.3,0) node[anchor=north] {$\mathbf{a}$};
  \draw[->, very thick, red!70!black] (0,0,0) -- (0.4,1.5,0) node[anchor=west] {$\mathbf{b}$};
  \draw[->, very thick, green!50!black] (0,0,0) -- (0,0,2.2) node[anchor=east] {$\mathbf{a} \times \mathbf{b}$};
\end{tikzpicture}
\end{document}
```
