Step 1: Evaluate \(\lim_{x \to 0} f(x)\):
Using standard limits: \(\lim_{x \to 0} \frac{a^x - 1}{x} = \log a\) and \(\lim_{x \to 0} \frac{1 - \cos x}{x^2} = \frac{1}{2}\).
\[ f(x) = \frac{x(a^x - 1)}{1 - \cos x} = \frac{x \cdot x\left(\frac{a^x - 1}{x}\right)}{1 - \cos x} = \frac{\frac{a^x - 1}{x}}{\frac{1 - \cos x}{x^2}} \]
Taking limit as \(x \to 0\):
\[ \lim_{x \to 0} f(x) = \frac{\log a}{1/2} = 2\log a \]
Step 2: Evaluate \(\lim_{x \to 0} g(x)\):
Rewrite \(g(x)\) by rationalizing the denominator:
\[ g(x) = \frac{x(1 - a^x)}{a^x (\sqrt{1 - x^2} - \sqrt{1 + x^2})} \cdot \frac{\sqrt{1 - x^2} + \sqrt{1 + x^2}}{\sqrt{1 - x^2} + \sqrt{1 + x^2}} \]
\[ g(x) = \frac{x(1 - a^x)(\sqrt{1 - x^2} + \sqrt{1 + x^2})}{a^x [(1 - x^2) - (1 + x^2)]} = \frac{x(1 - a^x)(\sqrt{1 - x^2} + \sqrt{1 + x^2})}{a^x (-2x^2)} \]
Simplify the term \(\frac{1 - a^x}{-x} = \frac{a^x - 1}{x}\):
\[ g(x) = \frac{x}{-2x^2 a^x} (1 - a^x) (\dots) = \frac{-(a^x - 1)}{-2x a^x} (\dots) = \frac{1}{2 a^x} \left(\frac{a^x - 1}{x}\right) (\sqrt{1 - x^2} + \sqrt{1 + x^2}) \]
Taking limit as \(x \to 0\):
\(a^0 = 1\), \(\frac{a^x - 1}{x} \to \log a\), term in bracket \(\to \sqrt{1} + \sqrt{1} = 2\).
\[ \lim_{x \to 0} g(x) = \frac{1}{2(1)} (\log a) (2) = \log a \]
Step 3: Calculate Difference:
\[ \lim_{x \to 0} (f(x) - g(x)) = 2\log a - \log a = \log a \]