Hat in LaTeX (\hat{x})

x^\hat{x}
LaTeX command
\hat{x}
Package
No package needed: built into LaTeX
Mode
Math mode only

Where it is used

Places a small circumflex over one character, marking estimators, unit vectors or Fourier transforms.

Statisticians write \hat{\theta} for an estimator of \theta and \hat{y} for fitted values in regression, physicists use \hat{x} or \hat{\mathbf{n}} for unit vectors and quantum operators, and analysts write \hat{f} for the Fourier transform. The accent has a fixed width, so it only looks right over a single symbol; for several letters switch to \widehat{xy}. Over an i or j, use the dotless forms \imath and \jmath so the hat does not sit on top of a dot. In running text outside math mode the equivalent circumflex accent is \^{o}, not \hat.

Also listed under: الجبر الخطي

Minimal compilable example

Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.

β^=(X⊤X)−1X⊤y\hat{\beta} = (X^\top X)^{-1} X^\top y
\documentclass{article}
\begin{document}
Hat: $\hat{x}$

\[ \hat{\beta} = (X^\top X)^{-1} X^\top y \]
\end{document}

Related symbols

All التشكيل والمعدّلات →

Frequently asked questions

How do I write Hat in LaTeX?
Type \hat{x} in math mode, for example $\hat{\beta} = (X^\top X)^{-1} X^\top y$. It works in plain LaTeX without loading any package.
Which package do I need for \hat{x}?
None. \hat{x} is part of standard LaTeX, so it compiles with nothing in the preamble but the document class.
Can I use \hat{x} in text mode, or only in math mode?
Only in math mode. Outside $...$ LaTeX stops with "Missing $ inserted", so write $\hat{x}$ in running text.
Math poweredاكتب LaTeX باستخدام الذكاء الاصطناعي

أفضل محرر LaTeX بالذكاء الاصطناعي، بديل Overleaf

يساعد Octree الباحثين من أكثر من 15 جامعة على كتابة أوراق البحث بشكل أسرع باستخدام الذكاء الاصطناعي

  • أنشئ رسوم TikZ جميلة باستخدام الذكاء الاصطناعي
  • ارفع صورة وحولها إلى LaTeX بسلاسة
  • احصل على مساعدة فورية في كتابة وتنسيق أوراق البحث