I get something similar, but a couple of corrections. I don't know if my calculations are correct, but I can show you what I got.
One problem with the Bragg equation is the ## \theta ## is not measured from the normal to the surface. In the following derivation, I will use ## \theta ## as from the normal, and ## \theta ' ## as measured from the surface. The index "n" is assumed to be approximately 1 but is assumed to be ## n=1+\delta ##. (This is one of two places where I don't agree completely with what they stated.) ## \\ ## Beginning with ## 2nd cos(\theta_r)=m \lambda ## for constructive interference, and using Snell's law ## n sin(\theta_r)=sin(\theta_i) ##, then ## sin(\theta_r)=sin(\theta_i)/n ##. Also ## sin(\theta_i ')=cos(\theta_i) ##. This gives ## cos(\theta_r)=(1-(sin(\theta_i)/n)^2)^{1/2} ##so that ## n cos(\theta_r)=(n^2-sin^2(\theta_i))^{1/2}=(n^2-1+1-sin^2(\theta_i))^{1/2}=(n^2-1+cos^2(\theta_i))^{1/2}=(n^2-1+sin^2(\theta_i '))^{1/2} ##Now expand with ## n^2-1=2 \delta ## (approximately)and ## sin(\theta_i ') ## being the larger term. This gives ## n cos(\theta_r)=sin(\theta_i ')(1+2 \delta/sin^2(\theta_i))^{1/2}=sin(\theta_i ')(1+\delta/sin^2(\theta_i ') ) ##. Now we have that ## 2d sin(\theta_i ')=m \lambda ## (Bragg's law without correction).So that ## sin^2(\theta_i ')=(m \lambda)^2/(4 d^2) ## . Putting it all together: ## \\ ## $$ 2d sin(\theta_i ')(1+4 d^2 \delta/(m \lambda)^2)=m \lambda $$. I will try to proofread my response carefully, but I think I have done it correctly. Note that I get a "+" sign for the correction part, not in concurrence with the attachment in the OP.