The q-vector in fact has three components:

Consider that the x-ray beam points along +y, so that on the detector, the horizontal is x, and the vertical is z. We assume that the x-ray beam hits the flat 2D area detector at 90° at detector (pixel) position
. The scattering angles are then:
![{\displaystyle {\begin{alignedat}{2}\theta _{f}&=\arctan \left[{\frac {x}{d}}\right]\\\alpha _{f}^{\prime }&=\arctan \left[{\frac {z}{d}}\right]\\\alpha _{f}&=\arctan \left[{\frac {z}{d/\cos \theta _{f}}}\right]\end{alignedat}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/facc9ad57cd58f15e7403d40dc08f08815d3662b)
where
is the sample-detector distance,
is the out-of-plane component (angle w.r.t. to y-axis, rotation about x-axis), and
is the in-plane component (rotation about z-axis). The alternate angle,
, is the elevation angle in the plane defined by
. Also note that the full scattering angle is:
![{\displaystyle {\begin{alignedat}{2}2\theta _{s}=\Theta &=\arctan \left[{\frac {\sqrt {x^{2}+z^{2}}}{d}}\right]\\&=\arctan \left[{\frac {\sqrt {(d\tan \theta _{f})^{2}+(d\tan \alpha _{f}^{\prime })^{2}}}{d}}\right]\\&=\arctan \left[{\sqrt {\tan ^{2}\theta _{f}+\tan ^{2}\alpha _{f}^{\prime }}}\right]\\&=\arctan \left[{\sqrt {\tan ^{2}\theta _{f}+{\frac {\tan ^{2}\alpha _{f}}{\cos ^{2}\theta _{f}}}}}\right]\\\end{alignedat}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/ce190aa4f7dd836349234c33033cb245c49d4f20)
The total momentum transfer is:
![{\displaystyle {\begin{alignedat}{2}q&={\frac {4\pi }{\lambda }}\sin \left(\theta _{s}\right)\\&={\frac {4\pi }{\lambda }}\sin \left({\frac {1}{2}}\arctan \left[{\frac {\sqrt {x^{2}+z^{2}}}{d}}\right]\right)\end{alignedat}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/978ccef9bfce6510674b68221b9f287f94e0bc79)
Given that:
![{\displaystyle {\begin{alignedat}{2}\cos(\arctan[u])&={\frac {1}{\sqrt {1+u^{2}}}}\\\cos(2\theta _{s})&={\frac {1}{\sqrt {1+(x/d)^{2}}}}\\&={\frac {d^{2}}{\sqrt {d^{2}+x^{2}}}}\end{alignedat}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/d1a8ea8278a133aa48837d629fc54b907ee659f3)
We can also write:

The momentum transfer components are:

In-plane only
If
(and
), then
,
, and:

Check
As a check of these results, consider:

Where we used:
![{\displaystyle {\begin{alignedat}{2}\sin(\arctan[u])&={\frac {u}{\sqrt {1+u^{2}}}}\\\sin \theta _{f}&=\sin(\arctan[x/d])\\&={\frac {x/d}{\sqrt {1+(x/d)^{2}}}}\\&={\frac {x}{\sqrt {d^{2}+x^{2}}}}\end{alignedat}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/fc9628f0d308053600f4e02d8f80c69fc9f356d0)
And, we further note that:
![{\displaystyle {\begin{alignedat}{2}\cos(\arctan[u])&={\frac {1}{\sqrt {1+u^{2}}}}\\\cos \theta _{f}&={\frac {1}{\sqrt {1+(x/d)^{2}}}}\\&={\frac {d^{2}}{\sqrt {d^{2}+x^{2}}}}\end{alignedat}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/584da470743b7feac2b55988526dabce5b4313c4)
cont
Continuing:
![{\displaystyle {\begin{alignedat}{2}{\frac {q^{2}}{k^{2}}}&={\frac {x^{2}}{d^{2}+x^{2}}}{\frac {d^{4}}{d^{2}+z^{2}\cos ^{2}\theta _{f}}}+\left({\frac {d^{2}}{\sqrt {d^{2}+x^{2}}}}{\frac {d^{2}}{\sqrt {d^{2}+z^{2}\cos ^{2}\theta _{f}}}}-1\right)^{2}+{\frac {z^{2}}{d^{2}+z^{2}\cos ^{2}\theta _{f}}}{\frac {d^{4}}{d^{2}+x^{2}}}\\&=d^{4}{\frac {x^{2}+z^{2}}{(d^{2}+x^{2})(d^{2}+z^{2}\cos ^{2}\theta _{f})}}+\left({\frac {d^{4}}{\sqrt {(d^{2}+x^{2})(d^{2}+z^{2}\cos ^{2}\theta _{f})}}}-1\right)^{2}\\&={\frac {d^{4}x^{2}+d^{4}z^{2}}{d^{4}+d^{2}x^{2}+d^{4}z^{2}}}+\left({\frac {d^{4}}{\sqrt {d^{4}+d^{2}x^{2}+d^{4}z^{2}}}}-1\right)^{2}\\&={\frac {d^{2}x^{2}+d^{2}z^{2}}{d^{2}+x^{2}+d^{2}z^{2}}}+\left({\frac {d^{8}}{d^{4}+d^{2}x^{2}+d^{4}z^{2}}}-2{\frac {d^{4}}{\sqrt {d^{4}+d^{2}x^{2}+d^{4}z^{2}}}}+1\right)\\&={\frac {d^{2}x^{2}+d^{2}z^{2}}{d^{2}+x^{2}+d^{2}z^{2}}}+{\frac {d^{6}}{d^{2}+x^{2}+d^{2}z^{2}}}-2{\frac {d^{3}}{\sqrt {d^{2}+x^{2}+d^{2}z^{2}}}}+1\\&={\frac {d^{2}x^{2}+d^{2}z^{2}+d^{6}-2d^{3}{\sqrt {d^{2}+x^{2}+d^{2}z^{2}}}+d^{2}+x^{2}+d^{2}z^{2}}{d^{2}+x^{2}+d^{2}z^{2}}}\\&={\frac {d^{6}+d^{2}+d^{2}x^{2}+x^{2}+2d^{2}z^{2}-2d^{3}{\sqrt {d^{2}+x^{2}+d^{2}z^{2}}}}{d^{2}+x^{2}+d^{2}z^{2}}}\\&={\frac {(x^{2}+z^{2})}{(d^{2}+x^{2}+z^{2})}}{\frac {(d^{2}+x^{2}+z^{2})}{(x^{2}+z^{2})}}{\frac {d^{6}+d^{2}(1+x^{2}+2z^{2})+x^{2}-2d^{3}{\sqrt {d^{2}(1+z^{2})+x^{2}}}}{d^{2}(1+z^{2})+x^{2}}}\\&=?\\&={\frac {x^{2}+z^{2}}{d^{2}+x^{2}+z^{2}}}\\{\frac {q}{k}}&={\sqrt {\frac {x^{2}+z^{2}}{d^{2}+x^{2}+z^{2}}}}\\&={\frac {\sqrt {x^{2}+z^{2}}}{\sqrt {d^{2}+x^{2}+z^{2}}}}\\&={\frac {\left[{\sqrt {x^{2}+z^{2}}}/d\right]}{\sqrt {1+\left[{\sqrt {x^{2}+z^{2}}}/d\right]^{2}}}}\\&=\sin \left(\arctan \left[{\frac {\sqrt {x^{2}+z^{2}}}{d}}\right]\right)\\q&={\frac {2\pi }{\lambda }}\sin \left(2\theta _{s}\right)\end{alignedat}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/1ec9f3c8b23c8d667e098945bc49229940656e47)