Verification for calculation on Shor's code

Here I have tried to determine the end result for the qubit states, when we apply an arbitrary gate on the first qubit in the 9 qubit code.

I have followed this diagram:

U's operation on a qubit can be written as: $$U|0\rangle\rightarrow a_{0}|0\rangle+b_{0}|1\rangle$$ $$U|1\rangle\rightarrow a_{1}|0\rangle+b_{1}|1\rangle$$

Let us say that this error occurs on the first qubit of the first inner group. $$\alpha{(U|0\rangle|00\rangle+U|1\rangle|11\rangle)(|000\rangle+|111\rangle)(|000\rangle+|111\rangle)}/{2\sqrt{2}}+\beta{(U|0\rangle|00\rangle-U|1\rangle|11\rangle)(|000\rangle-|111\rangle)(|000\rangle-|111\rangle)}/{2\sqrt{2}}$$

$$\Rightarrow$$ $$\alpha{(a_{0}|000\rangle+b_{0}|100\rangle+a_{1}|011\rangle+b_{1}|111\rangle)(|000\rangle+|111\rangle)(|000\rangle+|111\rangle)}/{2\sqrt{2}}+\beta{(a_{0}|000\rangle+b_{0}|100\rangle-a_{1}|011\rangle-b_{1}|111\rangle)(|000\rangle-|111\rangle)(|000\rangle-|111\rangle)}/{2\sqrt{2}}$$

After CNOT and Toffoli, $$\alpha{(a_{0}|000\rangle+b_{0}|011\rangle+a_{1}|111\rangle+b_{1}|100\rangle)(|000\rangle+|111\rangle)(|000\rangle+|111\rangle)}/{2\sqrt{2}}+\beta{(a_{0}|000\rangle+b_{0}|011\rangle-a_{1}|111\rangle-b_{1}|100\rangle)(|000\rangle-|111\rangle)(|000\rangle-|111\rangle)}/{2\sqrt{2}}$$

After Hadamard on primary qubits(1st,4th and 7th) and neglecting syndrome bits of inner groups (neglecting 2nd,3rd,5th,6th,8th,9th qubit): $$\alpha{(a_{0}|+\rangle+b_{0}|+\rangle+a_{1}|-\rangle+b_{1}|-\rangle)(|+\rangle+|-\rangle)(|+\rangle+|-\rangle)}/{2\sqrt{2}}+\beta{(a_{0}|+\rangle+b_{0}|+\rangle-a_{1}|-\rangle-b_{1}|-\rangle)(|+\rangle-|-\rangle)(|+\rangle-|-\rangle)}/{2\sqrt{2}}$$

$$\Rightarrow$$ $$\alpha{(a_{0}|+\rangle+b_{0}|+\rangle+a_{1}|-\rangle+b_{1}|-\rangle)(|0\rangle)(|0\rangle)}/{2\sqrt{2}}+\beta{(a_{0}|+\rangle+b_{0}|+\rangle-a_{1}|-\rangle-b_{1}|-\rangle)(|1\rangle)(|1\rangle)}/{2\sqrt{2}}$$

$$\Rightarrow$$ $$\alpha[{(\frac{[a_{0}+b_{0}+a_{1}+b_{1}]|0\rangle+[a_{0}+b_{0}-a_{1}-b_{1}]|1\rangle}{\sqrt{2}})(|0\rangle)(|0\rangle)}]/{2\sqrt{2}}+\beta[{(\frac{[a_{0}+b_{0}-a_{1}-b_{1}]|0\rangle+[a_{0}+b_{0}+a_{1}+b_{1}]|1\rangle}{\sqrt{2}})(|1\rangle)(|1\rangle)}]/{2\sqrt{2}}$$

After the final set of CNOT and Toffoli operations: $$\alpha[{(\frac{[a_{0}+b_{0}+a_{1}+b_{1}]|0\rangle}{\sqrt{2}})(|0\rangle)(|0\rangle)}+(\frac{[a_{0}+b_{0}-a_{1}-b_{1}]|0\rangle}{\sqrt{2}})(|1\rangle)(|1\rangle)]/{2\sqrt{2}}+\beta[{(\frac{[a_{0}+b_{0}-a_{1}-b_{1}]|1\rangle}{\sqrt{2}})(|1\rangle)(|1\rangle)}+(\frac{[a_{0}+b_{0}+a_{1}+b_{1}]|1\rangle}{\sqrt{2}})(|0\rangle)(|0\rangle)]/{2\sqrt{2}}$$

I'm not sure on what to do after this. Have I made mistakes so far? How to complete it?

I think you're OK so far. You just need to rearrange some terms a bit. Your final state is the same as $$\frac{a_0+b_0+a_1+b_1}{\sqrt{2}}(\alpha|0\rangle+\beta|1\rangle)|00\rangle+\frac{a_0+b_0-a_1-b_1}{\sqrt{2}}(\alpha|0\rangle+\beta|1\rangle)|11\rangle$$ which, again, is the same as $$(\alpha|0\rangle+\beta|1\rangle)\left(\frac{a_0+b_0+a_1+b_1}{\sqrt{2}}|00\rangle+\frac{a_0+b_0-a_1-b_1}{\sqrt{2}}|11\rangle\right),$$ so you can see that the first qubit comes out as the correct (original) state. Some of the information about what error has happened is stored on some of the other qubits.