Question: Let g: $\mathbb{R}$ $\to$$\mathbb{R}$ be a function (not necessarily continuous) which has a maximum and minimum on $\mathbb{R}$.Let $f:$ $\mathbb{R}$ be a function which is continuous on the range of g. Does $f$ of $g$ necessarily have a maximum on $\mathbb{R}$? Prove your answer, or provide a counterexample.
How exactly do I solve this? I have no conception on what to do? My guess was that I could use $sin(x)$ or some other trig function?

The answer is no.
We can build $g$ as follows: set the maximum and minimum to be $\pm 1$, by setting $g(1) = 1, g(-1) = -1$. Set everything in between $-1$ and $1$ to be anything that's not $0$, like say $\frac 12$.
Now for the rest of the function, make $g(x)$ always be positive for $x>1$, but tend to $0$, and similarly, make $g(x)$ always be negative for $x<-1$, but tend to $0$.
Now we choose $f: [-1,1] \to \mathbb{R}$ which is continuous and attains a unique maximum at $x=0$ (there are many such examples; you could simply take a triangular spike, or take $\cos(x)$, for example). Clearly, $f(x)$ will get arbitrarily close to its maximum at $0$, since $g$ tends to $0$ at either end, but $f(x)$ will never actually attain this maximum.