I am still trying to prepare for my electromagnetics preliminary exam, but I find myself stuck on understanding the origins of Eqs. 10.105a, 10.105b, 10.106a, and 10.106b on page 453 of Elements of Electromagnetics 3rd edition (these can be seen on page 44 of the PDF located here).
The equations, reproduced below, are $$ \mathbf{E}_{is}=E_{i0}\left(\cos\theta_{i}\mathbf{a}_{x}-\sin\theta_{i}\mathbf{a}_{z}\right)e^{-j\beta_{1}\left(x\sin\theta_{i}+z\cos\theta_{i}\right)}\\\mathbf{H}_{is}=\frac{E_{i0}}{\eta_{1}}e^{-j\beta_{1}\left(x\sin\theta_{i}+z\cos\theta_{i}\right)}\mathbf{a}_{y}\\\mathbf{E}_{rs}=E_{r0}\left(\cos\theta_{r}\mathbf{a}_{x}+\sin\theta_{r}\mathbf{a}_{z}\right)e^{-j\beta_{1}\left(x\sin\theta_{r}-z\cos\theta_{r}\right)}\\\mathbf{H}_{rs}=-\frac{E_{r0}}{\eta_{1}}e^{-j\beta_{1}\left(x\sin\theta_{r}-z\cos\theta_{r}\right)}\mathbf{a}_{y} $$
These represent the phasor forms of the incident electric field, incident magnetic field, reflected electric field, and reflected magnetic field, respectively. Here, the direction of propagation of the wave is at an angle $\theta_i$ with respect to the normal to the surface of the boundary between two lossless dielectric materials.
So I tried to understand the origins of these equations, as I've been doing through the course of going through this book, and the results of my work appear below
I think I have the right idea, but my signs are off. But it's confusing because I have the sign to the $x$ component of $\mathbf{E}_{i}$ correct, but not the sign to the $z$ component of $\mathbf{E}_{i}$ But both of those terms just came from the drawing and I don't understand where a negative sign could come in for the $z$ component. Perhaps my $r$ vector, given by $$r = x\mathbf{a}_{x} + y\mathbf{a}_y + z\mathbf{a}_z$$ is somehow wrong? Once again, any help is appreciated.
EDIT: Here's what the image should look like.
Therefore the derivation I had previously provided becomes
But note that I'm off by a minus sign in the complex exponential part. Looking at the updated diagram, I think it's easy to see that $\mathbf{k}_i$ has a $+\mathbf{a}_x$ component and a $+\mathbf{a}_z$ component. So that leads me to believe that my $\mathbf{r}$ is wrong. Should it perhaps be $\mathbf{r} = -x\mathbf{a}_x + y\mathbf{y} - z\mathbf{a}_z$? If so, why?