margin of error = z critical * sqrt(phat*(1-phat)/n)
z*critical * sqrt(phat*(1-phat)/n) <= 0.02
square both sides
z*critical^2 * (phat*(1-phat)/n) <= 0.02^2
multiply both sides by n
z*critical^2 * (phat*(1-phat)) <= 0.02^2 * n
divide both sides by 0.02^2
z*critical^2 * (phat*(1-phat)) <= n
--------------
0.02^2
z*critical for 96% confidence, is upper 0.02 tail (0.98 probability) = 2.05
phat = 0.51, 1-phat = 0.49
2.05^2 * (0.51*0.49)
--------------------------- <= n
0.0004
2625.51 <= n
n = 2626