# Piece-wise Function with Variable

I have this piecewise function:

$g(x)=\begin{cases} \frac{x^2-a^2}{x-a}, & x\ne a \\ 8, & x=a \end{cases}$

From there I broke it down to:

$g(x)=\begin{cases} \frac{(x-a)(x+a)}{x-a}, & x\ne a \\ 8, & x=a \end{cases}$

I have to find the $a$ that makes the function continuous, hence I took the limit of the piecewise function at $a$. I used the definition of limit definition of continuity, and got this:

$$\lim_\limits{x\to a}(g(x))=g(a)$$

$$\lim_\limits{x \to a}(\frac{(x-a)(x+a)}{(x-a)})=8$$

$$\lim_\limits{x \to a}(x+a)=8$$

$$((a)+a)=8$$

$$2a=8$$

$$a=4$$

Usually if I have the right answer but the wrong steps the problem is generally wrong: is my solution, and method to the problem correct?

Your solution is mostly correct. You proved that the function is continuous at $a$. However, to make it complete, I would also mention that the function is continuous on $\mathbb{R}-\{a\}.$