Solving the system $(P1 - P2)\cdot y+S\cdot x-P2\cdot S=0$ and $y\cdot\cos(\alpha)+x\cdot\sin(\alpha)-H=0$ I am trying to validate some calculations of a paper I'm reading for a high school math project. In the paper, the authors have two line equations:
\begin{align*}
(P1 - P2) \cdot y + S \cdot x - P2 \cdot S &= 0 \\
y \cdot \cos(\alpha) + x \cdot \sin(\alpha) - H &= 0
\end{align*}
where $P1, P2, S, H$ are just some constants. The authors then state that when solved simultaneously, the coordinates of when the two lines intersect are
\begin{align*}
x &= \frac{\frac{H(P1-P2)}{\cos(\alpha)} + SP2}{S + \tan(\alpha)(P1-P2)} \\
y &= \frac{S(\frac{H}{\sin(\alpha)} - P2)}{S\cot(\alpha) + (P1-P2)}
\end{align*}
There were no derivations shown (this seems like normal practice from the papers I have read so far, so no complaints), so I am trying to fill in the gaps between the given line equations and the intersect coordinates. This is what I have so far
\begin{align*}
(P1 - P2) \cdot y + S \cdot x - P2 \cdot S = 0 
&\rightarrow y = -\frac{S \cdot x}{P1 - P2} + \frac{P2 \cdot S}{P1 - P2}
\\
y \cdot \cos(\alpha) + x \cdot \sin(\alpha) - H = 0
&\rightarrow y = -x\tan(\alpha) + \frac{H}{\cos(\alpha)}
\end{align*}
Thus, by setting these equations equal to each other, one gets
\begin{align*}
-\frac{S \cdot x}{P1 - P2} + \frac{P2 \cdot S}{P1 - P2} &=
-x\tan(\alpha) + \frac{H}{\cos(\alpha)}
\\
-\frac{S \cdot x}{P1 - P2} + x\tan(\alpha) &=
-\frac{P2 \cdot S}{P1 - P2} + \frac{H}{\cos(\alpha)}
\\
x \cdot \left(\tan(\alpha) - \frac{S}{P1 - P2}\right) &=
\frac{H}{\cos(\alpha)} -\frac{P2 \cdot S}{P1 - P2}
\\
x &=
\frac{\frac{H}{\cos(\alpha)} -\frac{P2 \cdot S}{P1 - P2}}{\tan(\alpha) - \frac{S}{P1 - P2}} \cdot \frac{(P1-P2)}{(P1-P2)}
\\
x &= \frac{\frac{H(P1-P2)}{\cos(\alpha)} - SP2}{\tan(\alpha)(P1-P2) - S}
\end{align*}
My plan was to first solve for $x$ and then use that to solve for $y$, but it seems like my approach is incorrect since my result doesn't match with that of the paper. I have checked the math and have not noticed what I did wrong. Any help to point out what I did wrong or ways to approach the problem differently is greatly appreciated.
Edit 1: Origin of problem


 A: The given equations are:
$ S x + (P_1 - P_2) y = P_2 S $ (1)
$ \sin \alpha \ x + \cos \alpha \ y = H$
or
$ x + \cot \alpha y = {H \over \sin \alpha}$
or
$ S x + S \cot \alpha \  y = {S H \over \sin \alpha}$ (2)
(2) - (1) gives
$ [ S \cot \alpha + (P_2 - P_1) ] y = {S H \over \sin \alpha} - P_2 S $
or
$ y = { {S H \over \sin \alpha} - P_2 S \over
      S \cot \alpha + (P_2 - P_1) } $
which can be simplified further as
$ y = { S (H - P_2 \sin \alpha ) \over
 S \cos \alpha + (P_2 - P_1) \sin \alpha} $.
Substituting this into (1), we get
$
S x + {(P_1 - P_2) S (H - P_2 \sin \alpha) \over
  S \cos \alpha + (P_2 - P_1) \sin \alpha} = P_2 S
$
Dividing by $S$, we get
$
  x + {(P_1 - P_2)  (H - P_2 \sin \alpha) \over
  S \cos \alpha + (P_2 - P_1) \sin \alpha} = P_2  
$
Thus, we get
$
x = P_2 - {(P_1 - P_2)  (H - P_2 \sin \alpha) \over
  S \cos \alpha + (P_2 - P_1) \sin \alpha} $
After simplification, we get
$
x = {P_2 S \cos \alpha - (P_1 - P_2) H \over
   S \cos \alpha + (P_2 - P_1) \sin \alpha} $
