TITLE: Is $\tan\theta\cos\theta=\sin\theta$ an identity?
QUESTION [8 upvotes]: A friend of mine, who is a high school teacher, called me today and asked the question above in the title. In an abstract setting, this boils down to asking whether an expression like "$f=g$" is regarded as an "identity" when one of their domains is a proper subset of the other, and the two functions coincide on the smaller domain. Examples of such equalities are abundant in high school mathematics exercises, e.g. $\frac{x^2-1}{x-1}=x+1,\ e^{\log x}=x$ etc.. Often, the domains are not specified in the exercises.
A somewhat similar but subtly different case is when both functions are defined on the same domain but whether they are equal depends on the exact domain. For instance, $e^{x+y}\equiv e^xe^y$ for real or complex numbers but not for quaternions. Yet, for the purpose of discussion, let us focus on the aforementioned case of $f$ and $g$. For pedagogical purposes:

Do you consider $f=g$ an "identity"? What does an identity mean?
How to convince high school students that your definition is a good one?

REPLY [11 votes]: To be precise, a statement $f(x)=g(x)$ should always be accompanied by specifying the range of all free variables involved (in this case, presumably $x$ and only $x$ is free), e.g. "for all real $x$" or - in your example - "for all $\theta\in\mathbb R\setminus(2\mathbb Z+1)\frac\pi2$". 
On the other hand, if one works with functions, then $f=g$ automatically means: $f(x)=g(x)$ for all $x$. Even if one does not care for differences on negligible sets (e.g. sets of Lebesgue measure $0$), one should write "$f(x)=g(x)\text{ a.e.}$" to mention this; one can unambiguously use strict equality if one works with appropriate equivalence classes of functions.
It is often understood that an implicit "almost everywhere" or "whenever both sides are defined" or similar should be added. Similarly, when introducing additivity of limits, one tends to memorize only
$$ \lim_{n\to\infty}(a_n+b_n)=\lim_{n\to\infty}a_n+\lim_{n\to\infty}b_n,$$
but the complete statement really involves "which is to say that if the two limits on the right exist, then so does the limit on the left and its value is the sum of the two single limits" or "if two of the limits exist then so does the third and the equality holds".
So to repeat: To be careful, domain restrictions should always be explicitly stated.
Especially, an exercise definitely should be written with so much care that the domain and any exceptions are mentioned explicitly. E.g. no exercise should ask "Show that $\frac{x^2-1}{x-1}=x+1$", but "Show that $\frac{x^2-1}{x-1}=x+1$ for $x\ne1$". However, you may encounter "Hint: Use $e^{\ln x}=x$" without specification of domain (or in complex analysis: branch) if the hint is to be applied for a suitable situation (in which case your answer must include "... because $x>0$" or the like).