When I first learned calculus, I was taught that $'$ for derivatives was only a valid notation when used with function notation: $f'(x)$ or $g'(x)$, or when used with the coordinate variable $y$, as in $y'$.
But I have seen on a number of occasions, both here and in the classroom, where it will be used with an expression. E.g. $(x+\frac{1}{x})'$ to mean $\frac{d}{dx}(x+\frac{1}{x})$. It has always been my understanding that this notation is not considered valid because it doesn't indicate what the independent variable that the expression is being differentiated with respect to is. E.g. in $(ax+bx^2)'$, the variable could be $a$, $b$, or $x$. This problem also exists with $y'$ but I figured this was an exception because $y$ and $x$ usually represent the coordinate axes so it can be assumed that the independent variable for $x$ is $y$ when taking $y'$.
So is this notation valid, just putting a $'$ at the end of an expression?