Suppose $f$ is continuous on $[-1;1]$ such that $x^2 +f^2(x) = 1$ for all $x$. Show that $f(x) = \sqrt{1-x^2}$ or $f(x) = -\sqrt{1-x^2}$ for all $x$
This is my idea:
$x^2 + f^2(x) = 1 \Leftrightarrow f^2(x) = 1-x^2 $, for $x\in[-1;1] (*)$
So: With $(*)$, we can generally conclude the value of $f$ on $[-1;1]$:
$f(x) = \begin{cases} \sqrt{1-x^2} &x\in K\\ -\sqrt{1-x^2} &x\in [-1;1]\setminus K \end{cases}$
given some K satisfying $\emptyset \subseteq K \subseteq [-1;1]$ and $f$ is continuous on $[-1;1]$
(So, if $K$ contains some point $x_0$ that is not $\pm1$ then it also has to contain all points that are close to $x_0$ )
If we choose $K$ such that $K$ and $([-1;1]\setminus K$) contains at least one point that is not $\pm 1$, say respectively $c$ and $d$, we clearly have $f(c)>0>f(d)$. But since $f$ is continuous on $[c;d]$ or $[d;c]$, $\exists y\in[c;d]$ or $y\in[d;c]: f(y) = 0$, which is impossible due to the fact that $\forall x \in[c;d]$ or $[d;c]$ $\subset [-1;1]: f(x) \neq 0$. This case is not feasible.
So, we must have $K$ or ($[-1;1]\setminus K$) contains only $-1$ or $1$ or both or be empty. What if we choose $K = \text{{$1$}}$ ? By that, we still have $\text{$f$ is continuous on} [-1;1]$ and we don't seem to able to use the above argument to prove such a case is absurd.
So, shouldn't we add to hypothesis the fact that $f(-1), f(1)\neq 0$. What's wrong here ?
As already said in the comments, $f(-1) = f(1) = 0$ always holds. But your argument works if you apply it to $$ K = \{ x \in (0, 1) \mid f(x) = \sqrt{1-x^2} \} $$ and $(0, 1) \setminus K$.
One can also use a connectedness argument: Use the continuity of $f$ to show that both $$ K = \{ x \in (0, 1) \mid f(x) > 0 \} \\ K' = \{ x \in (0, 1) \mid f(x) < 0 \} $$ are open. Since $(0,1) = K \cup K'$ is connected, one of them must be empty.
The latter approach works also in the more general case where the domain of the function is a connected subset in $\Bbb R^n$ (or any topological space), when the intermediate value property can not be applied: