# Understanding how unitary operation changes state of system

While reading "Quantum Computation and Quantum Information" (by Nielsen and Chuang) I came across this line

A little thought shows that if we apply $$U_f$$ to the state $$\vert x \rangle (\dfrac{\vert 0 \rangle - \vert 1 \rangle}{\sqrt{2}})$$ then we obtain the state $$(-1)^{f(x)} \vert x \rangle (\dfrac{\vert 0 \rangle - \vert 1 \rangle}{\sqrt{2}})$$

Which was mentioned when explaining Deutsch's problem, where $$\vert x, y \rangle$$ is mapped to $$\vert x, y \oplus f(x) \rangle$$.

I was wondering, is this statement true for all unitary operations? Or is it limited to Deutsch's problem?

It is limited to matrix $$U_f$$ which maps $$|x,y\rangle$$ to $$|x,y\oplus f(x)\rangle$$, and the little thought is
$$U_f|x,-\rangle=\frac{1}{\sqrt{2}}(|x,0\oplus f(x)\rangle-|x,1\oplus f(x)\rangle)=$$ $$=\begin{cases} |x,-\rangle & \text{if }f(x)=0\\ -|x,-\rangle & \text{if }f(x)=1 \end{cases}=(-1)^{f(x)}|x,-\rangle$$ where $$x\in\{0,1\}$$ or generally $$x\in\{0,1\}^n$$