After placing the Hadamards on the 2 qubits (both initialized in the $|1\rangle$ state) in the circuit, we are given:
$ |\psi_{b}\rangle = \frac{1}{2}(|0_{1}0_{2}\rangle -|1_{1}0_{2}\rangle -|0_{1}1_{2}\rangle +|1_{1}1_{2}\rangle) $
the above state is run through the f-cnot, and we are given a superposition:
$ |\psi_{c}\rangle = \frac{1}{2}(|0_{1}f(0_{2})\rangle -|1_{1}f(1_{2})\rangle -|0_{1}\tilde f(0_{2})\rangle +|1_{1}\tilde f(1_{2})\rangle ) $.
In order to compute whether the function is balanced or not, we can use some factoring:
If $ f(0)=f(1) $ we can factor out: $ |\psi_{c}\rangle = \frac{1}{2}(|0_{1}\rangle -|1_{1}\rangle)(|f (0_{2})\rangle - |\tilde f (0_{2})\rangle) $
If $ f(0)=\tilde f(1) $ we can factor out: $ |\psi_{c}\rangle = \frac{1}{2}(|0_{1}\rangle +|1_{1}\rangle)(|f (0_{2})\rangle - |\tilde f (0_{2})\rangle) $
Question:
How are these two factored-out states for $ f_1 $ and $ \tilde f_1 $, actually pulled out of the original superposition? Like, how are they actually factored?