# putting ^ over character in math expressions [duplicate]

I am trying to achieve ^ over any letter in math formula. In normal text, it works with \^letter. However in my case, I am using

    \begin{align*}
\mathcal{L} = \frac{1}{n}\sum_{i=1}^{n}(y^{i}-\^{y}^{(i)})^{2}
\end{align*}


which outputs nothing on the place where y with ^ should be. What is a workaround for this or how can I achieve it?

Thanks for help.

• – Mico Apr 7 '18 at 14:17

The math accent for ^ is called \hat, see "The Comprehensive LaTeX Symbol List".
\documentclass{article}
$\mathcal{L} = \frac{1}{n}\sum_{i=1}^{n}(y^{i}-\hat{y}^{(i)})^{2}$