The LaTeX command for hat is \hat{x} (hat / estimate).
\hat{x}Writing a paper? The table generator and the BibTeX cleaner are one click away, no account.
| Command | Package | Use it when |
|---|---|---|
\hat{x} recommended | none | Hat over one letter: an estimator, a unit vector. |
\widehat{xy} | none | Wide hat over several letters. |
\hat{\beta} | none | An estimated coefficient. |
\hat{\imath} | none | Unit vector: \imath drops the dot under the hat. |
\^{o} | none | Circumflex in running text, as in r\^{o}le. |
Write \hat{x} inside math mode, that is between $…$ for inline math or in a \[ … \] or equation block for display math. It is part of core LaTeX math, so no extra package is required.
$\hat{\beta} = (X^\top X)^{-1} X^\top y$Open this example in the live preview: it renders as you type, with no compiler and no signup.
\grave{x}\check{x}\breve{x}\mathring{x}\widehat{xy}\widetilde{xy}\underline{x}\tilde{x}\bar{x}\overline{x}\overbrace{x}^{n}\underbrace{x}_{n}\vec{x}\dot{x}Math accents in LaTeX: the full table or search all 350+ LaTeX symbols.
Use \hat{x} in math mode; it needs no extra package. For example, $\hat{\beta} = (X^\top X)^{-1} X^\top y$.
None: \hat{x} is built into LaTeX, so no extra package is required.
\hat works only in math mode; in text use \^{o}, or type the accented letter directly.