# Implementing depth-3 circuit for XOR

In this set of notes, they claim that there is a size $$O(2^{\sqrt n})$$ depth-3 circuit (OR -AND -OR) that implements XOR.

I tried for a little bit to figure out how to do this, but couldn't find such a construction. How do you do this?

• The claim assumes that you can use both the inputs and the negations of the inputs. Does that help? – Wandering Logic Mar 12 '19 at 21:24
• Nice question! It's easy to see how to do it in depth 4, and that suffices for the point made in those notes (deeper circuits can help). I still don't see how to do it in depth 3, though. – D.W. Mar 12 '19 at 21:38
• Compose two XORs on $\sqrt n$ bits. Use both a CNF and a DNF for the lower XORs (and use de Morgan liberally). – Yuval Filmus Mar 12 '19 at 23:05
• I think basically the idea is that you can use the CNF on the top and the DNF on the bottom. You can collapse the ANDs by associativity. Yes, you have negations in the middle but by de Morgan's law you can push them down. – Josh B. Mar 13 '19 at 3:08