What exactly does $g^2(x)$ mean I know there's (kind of?) some controversy as to what $g^2(x)$ means — it could be $g(g(x))$, or $(g(x))^2$ or even $g''(x)$. I'm taking a calculus course and assumed that $g^2(x)$ meant $g''(x)$, but it turns out that the solution saw this as $(g(x))^2$. 
Here's the problem if it will clarify things:

If $P(x) = g^2(x)$, then $P'(x)$ equals...

(of course, there's a table given with values of g and g' accompanying the problem and answer choices, but I'm not including them here because of copyright.)
So in general, is there any way I can determine which one exactly the problem means when $g^2(x)$ appears?
 A: If it means $g''(x) $, you should write
$$g^{(2)}(x) $$
If it is $g(x).g (x) $, you will write
$$(g(x))^2$$
so $g^2 (x) $ means $$g (g (x)) $$
A: It usually depends on the circumstance the problem is situated in.
For example, if you're doing calculus, it's probably good notation to avoid using $g^2$ to denote the 2nd derivative and simply use $g''$ as this avoids confusion.
If you're doing something like linear algebra, the notation $T^n$ would probably mean matrix multiplication, i.e., $T^n = T\circ T\circ \cdots \circ T$.
For me, I usually use the following convention:


*

*$g(x)^2$ to denote square of $g(x)$

*$g^2(x)$ to denote $g\circ g$

*$g^{(2)}(x)$ to denote the 2nd derivative


Of course, there are probably special cases in which I may abuse notation just for sake of simplicity (e.g $\cos^2(x)$ is the square of $\cos$), but I think it's good practice to keep your notation uniform throughout your notes and textbooks. I would believe that most authors abide by this rule and would at least mention it in their text if they're changing notation.  
