<s>[INST] derive limit to make a function continuous Here's the problem:
Choose the value of k that makes the following 
function continuous at $x = 1$:
$f(x)=\begin{cases}
\frac{-8x^2 + 48x - 40}{x - 1} & x < 1\\
-2x + k &x \geq 1
\end{cases}$
My steps:
$\lim_{x\uparrow 1} f(x) = \lim_{x\downarrow 1} f(x)$
$\frac{-8x^2 + 48x - 40}{x - 1} = -2x + k$
$\frac{-8(x^2 - 6x + 5)}{x - 1} = -2x + k$
$\frac{-8(x - 5)(x - 1)}{x - 1} = -2x + k$
$-8(x - 5) = -2x + k$
$-8x - (-8)\cdot5 = -2x + k$
$-8x + 40 = -2x + k$
$-8x + 2x + 40 = k$ (See note at bottom)
$-6x + 40 = k$
$-6\cdot1 + 40 = k$
$-6 + 40 = k$
$36 = k$
The solution steps:
For f to be continuous at $x = 1$ we need $\lim_{x\uparrow 1} f(x) = \lim_{x\downarrow1} f(x) = f(1)$
First lets evaluate lim x→1− f(x). Since x < 1 as x approaches 1 from the left, 
f(x) = (−8x^2 + 48x − 40)/(x − 1) as x→1−
So lim x→1− f(x) = lim x→1−  (−8x^2 + 48x − 40)/(x − 1)
Start by factoring the numerator. 
In this case we find: 
lim x→1− (−8x^2 + 48x − 40)/(−3x^2 − 15x + 18) = lim x→1− (−8x + 40)(x − 1)/(x − 1)
Aside: can anyone explain (−3x^2 − 15x + 18) in the denominator?
Since we are taking the limit as x→1−, we may assume that x ≠ 1. 
Canceling factors we see: 
\lim x→1− (−8x + 40)(x − 1)/(−3x − 18)(x − 1) = \lim x→1− (−8x + 40)
We can evaluate this linear function at x = 1. 
Hence, 
lim x→1− −8x^2 + 48x − 40)/(−3x^2 − 15x + 18) = −8(1) + 40. 
Thus, lim x→1− f(x) = 32. 
Thus lim x→1− f(x) = 32 
lim x→1+ f(x) = lim x→ (−2x + k), because x > 1 as x approaches 1 from the right. 
lim x→ (−2x + k) = −2⋅1 + k = −2 + k = f(1) because linear functions are continuous. 
For f to be continuous, these limits have to be equal. Thus 32 = −2 + k 
When k = 34, f is continuous.

NOTE: This is where I diverged from the solution by moving -2x to the left. My question is, assuming the given solution is correct, why is this nominally valid algebraic step not permitted?
 [/INST] To address your aside: this is likely a typo.
To address your note: the $-2x$ term contains a variable $x$ whose scope is unrelated to the other variable on the other side of the equation. It's a bit unfortunate that we reuse the same variable, as this might be confusing. To emphasize the fact that the variables on each side of the equation for the different limits are unrelated, we could have written our work by doing something like:
\begin{align*}
\lim_{x \to 1^-} f(x) &= \lim_{y \to 1^+} f(y) \\
\vdots\qquad &= \qquad\vdots \\
\lim_{x \to 1^-} (-8x + 40) &= \lim_{y \to 1^+} (-2y + k) \\
-8(1) + 40 &= -2(1) + k \\
k &= 34
\end{align*}
</s>