# How to add superscript on summation symbol

I'd like to add superscript on summation symbol, but I get an error message:

Please, use \mathaccent for accents in math mode.
I can't use ^ symbol to add superscript.


Here is the code:

$$y & = \beta_{0}+\sumˆ{2}_{j=1}\beta_{j}X_{j}+\sum\sum_{i<j}\beta_{ij}X_{i}X{j}+\sum_{j=1}\beta_{jj}X_{j}\textsuperscript{2} \label{equation1}$$

• Welcome to TeX.SX! It's not at all clear where the superscript is meant to go. Besides, \textsuperscript is not valid in math mode. And the & is out of place. – egreg Mar 12 '19 at 0:03
• You might look at the \sideset command from amsmath. If you have a tex installation based on TeX Live, tyou shoyuld be able to look at this documentation locally via texdoc amsldoc at a command prompt. – barbara beeton Mar 12 '19 at 0:15

You have a wrong ^ character that is not a ascii character but possibly something with similar appearance and this is what causes the whole problem.

Your code with the correct character is something like:

\documentclass{article}

\begin{document}
$$y = \beta_{0}+\sum_{j=1}^{2} \beta_{j}X_{j}+\sum\sum_{i<j}\beta_{ij}X_{i}X{j}+\sum_{j=1}^2\beta_{jj}X_{j}^2 \label{equation1}$$
\end{document}


And gives:

PS1: Not sure about the last power and the last upper limit of the sum, but you will see it works if you just delete your bad character and replace with the original keyboard's ^.

PS2: For readability never start a sum by its upper limit, but use first its lower limit instead.

• Thank you, koleygr. It worked. – Luciana Mar 13 '19 at 1:03
• Weclome.. Happy TeXing! – koleygr Mar 13 '19 at 1:53