The symbols _ (underscore)and ^ (hat) can also be used to write superscripts and subscripts, respectively.
Here is an example:
\[ a_1^2 + a_2^2 = a_3^2 \]
The above LaTex code will produce the following output:
a12+a22=a32