# How to plot cosine with trigonometric identity

There is the well-known trigonometric identity: $$\sin^2(x)+\cos^2(x) = 1$$. Without giving a second thought I took use of it to convert from cosine to sine. Especially in physics involving reflections: $$\frac{n_2}{n_1}\,\cos(\alpha_2) = \frac{n_2}{n_1}\,\sqrt{1-\sin^2(\alpha_2)}$$. This helped many times. Just now I realized that plotting both sides of the equation actually lead to two different graphs. Even plotting $$\pm\sqrt{1-\sin^2(\alpha_2)}$$ does not equal the simple cosine. It seems like there has to be a piecewise function defined giving the positive square for positive $$\alpha_2$$ and vice versa. But why the first substitution without any case differentiation works in physical context?

• You are restricting the domain where $\alpha_2$ is defined. That formula is true if the angle is between $0$ and $90^\circ$. Aug 17, 2021 at 16:50
• Oh right, that's always the provided domain in reflection-physics.
– Leon
Aug 17, 2021 at 16:54
• Perhaps $\sin(\pi/2-x)=\cos(x)$, which holds for all x, will interest you, as it graphs nicely Aug 17, 2021 at 17:11

1. $$f(\alpha_2)=\cos(\alpha_2)$$ is a function because each input $$\alpha_2$$ returns a certain corresponding output $$f(\alpha_2).$$ Likewise for the function $$g(\alpha_2)=\sqrt{1-\sin^2(\alpha_2)}.$$ As $$\alpha_2$$ varies over the real numbers (let's work in radians), the values of $$f(\alpha_2)$$ and $$g(\alpha_2)$$ coincide precisely when $$\alpha_2$$ lies in the $$1$$st or $$4$$th quadrant (e.g., when $$\alpha_2$$ is acute). In this case, ($$\cos\alpha_2$$ is non-negative and) $$\cos(\alpha_2)=\sqrt{1-\sin^2(\alpha_2)}\tag1$$ instead of the more general $$\cos(\alpha_2)=\pm\sqrt{1-\sin^2(\alpha_2)}\tag2.$$
2. On the other hand, $$h(\alpha_2)=\pm\sqrt{1-\sin^2(\alpha_2)}$$ is not a function: its graph is symmetrical in the $$x-$$axis because each input value of $$\alpha_2$$ corresponds to two possible outputs.
3. The equality $$\cos^2(\alpha_2)=1-\sin^2(\alpha_2)$$ is called an identity because it is true for every possible value of $$\alpha_2$$. On the other hand, $$(1)$$ and $$(2)$$ are equations that are true for particular values of $$\alpha_2$$ (and which we are using to solve for $$\alpha_2,$$ for conversion between trigonometric ratios, etc.).

Let's start at the beginning.

Given:

$$\sin^2(x)+\cos^2(x) = 1$$

Then:

$$\cos^2(x) - (1 - \sin^2(x)) = 0$$

$$\cos^2(x) - \left(\sqrt{1 - \sin^2(x)}\right)^2 = 0$$

$$\left(\cos(x) - \sqrt{1 - \sin(x)}\right) \left(\cos(x) + \sqrt{1 - \sin(x)}\right) = 0$$

So the logic here is as follows. We know that $$\sin^2(x)+\cos^2(x) = 1$$ is true. It means that for all x, at least one of the following two statements has to be true:

(1) $$\cos(x) = \sqrt{1-\sin^2(x)}$$

(2) $$\cos(x) = - \sqrt{1-\sin^2(x)}$$

And it can be a different statement for a different x! And (based on some more other logical conclusions which you could go through on your own) it just so happens that:

• for all $$x \in [-\frac{\pi}{2} + 2\pi k; \frac{\pi}{2} + 2\pi k]$$ ($$k \in Z$$), (1) is true,
• and for all $$x \in [\frac{\pi}{2} + 2\pi k; \frac{3\pi}{2} + 2\pi k]$$ ($$k \in Z$$), (2) is true.

For example, if in some formula you were to say that for some $$x \in (\frac{\pi}{2}; \frac{3\pi}{2})$$, $$\cos(x) = \sqrt{1-\sin^2(x)}$$, this would be a mistake which would actually flip the sign of your expression.

So be careful and always check the domain in these kinds of situations.)