These are good attempts, but there is a snag. The solution for 1) is correct provided that a>0. But it does not work if a<0 because in that case x can take the value 0, and the function has a vertical asymptote there.

The solution to 2) fails for the same reason – it goes wrong at x=0. But you can easily put that right in this case by flipping the function over and defining Since x does not take the value 2, the denominator is not going to vanish.

TeX tip: the TeX engine used in this forum does not like line breaks. If you write your TeX input all on one line, as

[TEX]\begin{array}{l} f_1 \left( x \right) = \frac{{x - 2a}}{x} \\ f_2 \left( x \right) = \frac{{2 - x}}{x} \\ \end{array}[/TEX] ,

it will be rendered without the tiresome s.