Geometric probability with dependent choices. Please help me to finish the solution for this geometric probability problem:

We have segment $[A, B]$ of length $l$. Consider 2 cases:
  
  
*
  
*We randomly choose points X and Y on $[A, B]$.
  
*We randomly choose point X on $[A, B]$ and then randomly chose point Y on $[A, X]$.
  
  
  Find the probability that length of $AY$ is less than length of $BX$
  in each cases.

My attempt:
I think I solved case 1.
Let x is length of $AX$ and y is length of $AY$. Then condition $|AY| < |BX|$ means $y < l - x$. The probability should be ratio of areas of the triangle $\{x \geq 0, y \geq 0, x+y < l\}$ and square $\{ 0 \leq x \leq l, 0 \leq  y \leq l\}$. This ratio is $\frac12$ and my intuition gives me the same answer without calculations.
But in case 2 intuition suggest that answer will be different. But how can I approach that case? It is clear for me that my solution for case $1$ will not work for case $2$ since we lost the assumption of independence. But what should I do instead?
Thanks a lot for your help!
 A: One approach is as follows.
Let $X$ be a random variable giving the length of $\overline{AX}$ and $Y$ a random variable giving the length of $\overline{BY}$. We have that $X$ is uniformly distributed in $[0,l]$, so its probability density function is $f_X(x) = \frac{1}{l}$, and $Y$ is uniformly distributed in $[0,x]$ given $X=x$, so its conditional probability density function is $f_Y(y|X=x) = \frac{1}{x}$. Then the joint density is $f_{XY}(x,y) = f_X(x)\cdot f_Y(y|X=x) = \frac{1}{lx}$, supported in the region $0 \leq y \leq x \leq l$.
Now you can integrate the joint density in the intersection of the region $y < l-x$ with the support. This gives $\int_0^\frac{l}{2}\int_0^x \frac{dydx}{lx} + \int_\frac{l}{2}^l\int_0^{l-x} \frac{dydx}{lx} = \int_0^\frac{l}{2}\frac{dx}{l} + \int_\frac{l}{2}^l \frac{(l-x)dx}{lx} = \int_\frac{l}{2}^l \frac{dx}{x} = \ln2$
A: Case 2 can be done without double integrals. Let $X$ and $Y$ be defined as in the accepted answer. Now, by definition, $Y$ (given $X$) is Uniform on the interval $(0,X)$; that is, using Iverson brackets, we have the following:
$$P(Y<y\mid X) = {y\over X}\cdot[0<y<X]+1\cdot[y\ge X].$$
Therefore, 
$$\require{cancel}\begin{align}P(Y<l-X)&= E\,P(Y<l-X\mid X)\\[2ex]
&=E\,\left({l-X\over X}\cdot[0<l-X<X]+1\cdot[l-X\ge X]\right)\\[2ex]
&=E\,\left({l\over X}\cdot[l-X<X]\right) - E\,[l-X<X] + E\,[l-X\ge X]\\[2ex]
&=E\,\left({l\over X}\cdot\left[X>{l\over 2}\right]\right)-\cancel{P(X>{l\over 2}})+\cancel{ P(X\le {l\over 2})}\\[2ex]
&=\int_\limits{l/2}^l{l\over x}{1\over l}dx\\[2ex]
&=\ln 2.
\end{align}$$
