I am trying to understand the toffoli operation for the quantum adder below: (especially for the second toffoli gate) but I am stuck in understanding the calculation to get the correct outputs.
The carry bits and sum bits are defined as of below:
For the 2nd Toffoli gate, I cant seem to understand how to get a2⊕c2. I calculated their inputs up till the 2nd toffoli gate to be:
Input:
$b_1 \oplus a_1$,
$a_1 \oplus c_1$,
$a_1 \oplus a_2$
By definition of the toffoli gate, my outputs should be:
$b_1 \oplus a_1$,
$a_1 \oplus c_1$,
$(a_2 \oplus a_1) \oplus [(b_1 \oplus a_1)(a_1 \oplus c_1)]$
But after expanding the result and summarizing it: $$(a_2 \oplus a_1) \oplus [(b_1 \oplus a_1)(a_1 \oplus c_1)] = (a_2 \oplus a_1) \oplus (b_1a_1 \oplus b_1c_1 \oplus a_1a_1 \oplus a_1c_1)$$
i cant seem to equate it to $(a_2 \oplus c_2)$.