I get the missing $ inserted error(and many other errors like "missing } inserted") for the following code:
\documentclass[11pt,oneside,onecolumn]{article}
\usepackage{amsthm}
\usepackage{verbatim}
\begin{document}
\begin{eqnarray}
f(x)&=&\cos x\\
f'(x)&=&-\sin x\\
\int_0^xf(y)\ud y&=&\sin x
\end{eqnarray}
\end{document}
I have tried out different changes based on Googling for this error, but nothing seems to help. Any suggestions would be appreciated.

eqnarrayenvironment. Just remove the empty first and last line and things should compile provided you have defined\udsomewhere in your preamble. But as samcarter hints at, you should if at all possible avoideqnarrayand usealign(the same thing about empty lines applies: they are not allowed). – moewe Aug 09 '18 at 14:01