Consider a transmission line circuit like the following but where \$Z_{o2}\$ was also unique (say \$Z_{o2}=7\,\Omega\$):
I know how I would find \$l_1\$ and \$l_2\$ using smith charts:
$$Re\left\{Y_n(z=-l_1)\right\}=\frac{Z_{o1}}{Z_o}=0.5\rightarrow l_1=\left(0.106\lambda,\,0.394\lambda\right)$$
$$Y(z=-l_1)=Y_n(z=-l_1)\cdot Y_{o1}$$
$$Y_n(z=-l_2)=\frac{-Im\left\{Y(z=-l_1)\right\}}{Y_{o2}}=0.161j\rightarrow l_2=(0.161\lambda,\,0.349\lambda)$$
but, since I would like to write a program for calculating this, I need to be able to solve this from the governing equations.
Starting on page 230 in this book, the author describes the equations used for matching a circuit where \$Z_o=Z_{o1}=Z_{o2}\$ but how would I solve this problem in the more general case?