You can make a table. The first column and the first row are the possible outcomes of the two balls. For each combination the maximum value has been inserted.
$$ \begin{array}[ht]{|p{2cm}|||p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|p{0.5cm}|} \hline \text{ b1/b2 } & 0& 1 &2 &3 &4 &5 &6 &7&8&9 \\ \hline \hline \hline 0&-&1 &2 &3 &4 &5 &6&7&8&9 \\ \hline 1&1&- &2 &3 &4 &5 &6&7&8&9 \\ \hline 2& 2& 2&- & 3 &4 &5 & 6 &7&8&9 \\ \hline 3& 3 &3&3 &- &4 &5&6 &7&8&9\\ \hline 4 &4 &4 &4&4&-&5&6 &7&8&9\\ \hline 5 &5&5 &5&5&5&-&6&7&8&9 \\ \hline 6&6&6&6&6&6&6&-&7&8&9 \\ \hline 7&7&7&7&7&7&7&7&-&8&9 \\ \hline 8&8&8&8&8&8&8&8&8&-&9 \\ \hline 9&9&9&9&9&9&9&9&9&9&- \\ \hline \end{array}$$
There are $90 (=10\cdot 10-10)$ possible outcomes.
For $x=1$ we have 2 favorable outcomes. For $x=2$ There are 4 favorable outcomes. And so on. It is always the double of $x$. Thus the probability function is
$$f(x)=\begin{cases}{}\frac{2x}{90}, \text{if} \ x=0,1,\ldots 9 \\ 0, \ \text{elsewhere} \end{cases} $$