This is LaTeX code:
[latex]
P(X<Y)=\sum_{k=2}^{n}P(X<k,Y=k)=nezavisnost=\sum_{k=2}^{n}P(X<k)P(Y=k)=\sum_{k=2}^{n}\frac{k-1}{n}\frac{1}{n}=\frac{1}{{n}^{2}}\sum_{k=2}^{n}(k-1)=\frac{1}{{n}^{2}}\sum_{k=1}^{n-1}k= \frac{1}{{n}^{2}}\frac{(n-1)n}{2}=\frac{n-1}{2n}
[/latex]