In this case the domain of is all real numbers because we can calculate for x any real number. And, of course, the result of that calculation is always a positive number and can be any positive real number. That is why the range is all positive real numbers.
For , the domain is all positive numbers because (or logarithm of any base) is defined for all positive numbers but not for 0 or any negative numbers. If , though, and so the range is all real numbers.
In fact, for any positive number, a, and are inverse functions: if then so they "swap" domain and range. That is also why the graphs are symmetric about the line y= x.