Properties of function $f(a) + f'(x)(x-a)$ From the definition of derivative, combined with the equation of a  straight line, we know that the tangent to $f(x)$ in $a$ is
$$ g(x) = f(a) + f'(a)(x-a) $$
I was writing this equation in a function grapher, but I made a mistake and wrote $f(a) + f'(x)(x-a)$ instead ($x$ instead of $a$ in the derivative). However I noticed that this function approximates $f(x)$ very well (better than the tangent). What is it? Why it works so well?
 A: Let $g(x)=f(a)+f'(x)(x-a)$. Then
$$f(x)-g(x)= f(x)-f(a)-f'(x)(x-a)= (x-a) \left(\frac{f(x)-f(a)}{x-a}-f'(x) \right)$$
If $L(x)$ is the tangent approximation, then 
$$f(x)-L(x)= (x-a) \left(\frac{f(x)-f(a)}{x-a}-f'(a) \right)$$
Note that as long as $f'(x)$ is continuous at $x=a$, everything works nicely, but as uniquesolution pointed, this might not work nicely when $f'$ is not continuous at $x=a$. In that case, your approximation is clearly worse than the tangent approximation.
Note If you want to compare the two approximations, to decide which is better, the question simply becomes "Does $\frac{f(x)-f(a)}{x-a}$ approximate better $f'(x)$ or $f'(a)$?"
Geometrically the question you ask is "If $x$ is close to $a$, is the slope of the secant $(x,f(x))  - (a,f(a))$ closer to the tangent to the graph at $(x,f(x))$ or the tangent at $(a,f(a))$?"
I don't think that one should expect the answer to be independent of the choice of the function.
A: Let say the range of function is $[a-\epsilon,a+\epsilon]$, The taylor series expansion is for $x>a$, $f(x)=f(a)+f'(\psi)(x-a)$ where $\psi \in [a,x]$. The reason why it approximates well might probably be that for the function you are considering as $x$ increases $\psi \in [a,x], \psi \approx x$ approximates taylor series error term very well.
A: Taylor's theorem with remainder in Largrange form gives
$$f(x)=f(a)+f'(c_x)(x-a) $$
for some $c_x$ between $a$ and $x$.
Using Taylor's theorem again, one can write this as
$$f(x)=f(a)+\left( f'(x)+f''(d_{c_x} )(c_x-x)\right) (x-a)=g(x)+f''(d_{c_x})(c_x-x)(x-a)$$
for some $d_x$ between $x$ and $c_x$. Thus
$$|f(x)-g(x)| \leq |f''(d_{c_x})| |c_x-x||x-a| \leq |f''(d_{c_x})||x-a|^2 $$
which is better than the tangent line approximation, if $x$ is sufficiently close to $a$. 
A: It's certainly not better if $f'(x)$ is discontinuous at $a$. 
For example, the linear approximation to 
$$f(x) =
\begin{cases}
x^2\sin x^{-2}  & x \neq 0 \\
0 & x=0
\end{cases}$$
at $x_0 = 0$ is simply the zero function $p(x) = 0$. 
Your "new version" of the linear approximation, for this function, would be 
$$h(x) =
\begin{cases}
2x^2\sin x^{-2} - 2\cos x^{-2}  & x \neq 0 \\
0 & x=0
\end{cases}$$
which satisfies $\limsup_{x \to 0} h(x) = 2$ and $\liminf_{x \to 0} h(x) = -2$, so it is in no sense a good approximation. 
However, we can establish that the error is at least as good as the linear approximation assuming $f'$ is continuous at $a$. 
Let $p(x)$ denote the "normal" linear approximation of $f$ at $a$ and $h(x)$ denote your version. We know that 
$$p(x) - f(x) = o(x-a)$$
Furthermore, $$[h(x) - f(x)] - [p(x) - f(x)] = (x-a)(f'(x) - f'(a)) = o(x-a)$$ since $f'(x) - f'(a) \to 0$
Adding the above equalities, and noting that $o(g) + o(g) \subseteq o(g)$, it follows that $h(x) - f(x) = o(x-a)$
