I've been told that linear approximation is considered as "good" if it meets the criteria below: $$\lim_{x \to a} \frac{f(x)-f(a)-f'(a)(x-a)}{x-a} = 0$$
As far as I understand, the differentiation of $f(x)$ suppose to provide such a good approximation?
So I wrote a simple script testing out $f = x^2$ at the $a = 2$. Thus following sequence expected to be infinitely small: $$\lim_{x \to 2}\frac{x^2 - 4x - 12}{x - 2}$$
Now let me publish some bits of computation done by my machine:
["f(2.0001) = -160000"; "f(2.0002) = -80000"; "f(2.0003) = -53333.3"; "f(2.0004) = -40000"; "f(2.0005) = -32000"; "f(2.0006) = -26666.7"; "f(2.0007) = -22857.1"; "f(2.0008) = -20000"; "f(2.0009) = -17777.8"; "f(2.001) = -16000"; "f(2.0011) = -14545.5"; "f(2.0012) = -13333.3"; "f(2.0013) = -12307.7"; "f(2.0014) = -11428.6"; "f(2.0015) = -10666.7"; "f(2.0016) = -10000"; "f(2.0017) = -9411.76"; "f(2.0018) = -8888.89"; "f(2.0019) = -8421.05"; "f(2.002) = -8000"; "f(2.0021) = -7619.05"; "f(2.0022) = -7272.73"; "f(2.0023) = -6956.52"; "f(2.0024) = -6666.66"; "f(2.0025) = -6400"; "f(2.0026) = -6153.84"; "f(2.0027) = -5925.92"; "f(2.0028) = -5714.28"; "f(2.0029) = -5517.24"; "f(2.003) = -5333.33"; "f(2.0031) = -5161.29"; "f(2.0032) = -5000"; "f(2.0033) = -4848.48"; "f(2.0034) = -4705.88"; "f(2.0035) = -4571.43"; "f(2.0036) = -4444.44"; "f(2.0037) = -4324.32"; "f(2.0038) = -4210.52"; "f(2.0039) = -4102.56"; "f(2.004) = -4000"; "f(2.0041) = -3902.43"; "f(2.0042) = -3809.52"; "f(2.0043) = -3720.93"; "f(2.0044) = -3636.36"; "f(2.0045) = -3555.55"; "f(2.0046) = -3478.26"; "f(2.0047) = -3404.25"; "f(2.0048) = -3333.33"; "f(2.0049) = -3265.3"]
From the result above clearly seen: the closer $x$ gets to the $a = 2$, the bigger output.
How I suppose to interpret such a result? Did I do a mistake? Did I misunderstand the "good linear approximation" concept? Did I broke math?
Ok first of all the equation you have written is nothing but just the definition of derivative. The fact which you have expressed about linear approximation is something different and is expressed as follows
Your issue was minor mistake explained by other answers, but you do have some misunderstanding about the criterion for best linear approximation which I have tried to explain in my answer.
To prove the theorem we can easily notice that both $f, g$ are continuous at $a$ we have $$f(a) - g(a) =\lim_{x\to a} f(x) - g(x) =\lim_{x\to a} \frac{f(x) - g(x)} {x-a} \cdot(x-a) =0\cdot 0=0$$ so that $g(a) =f(a) $ or $$Aa+B=f(a)\tag{1}$$ Next we have $$0=\lim_{x\to a} \frac{f(x)-f(a)-(g(x)-g(a))}{x-a}=\lim_{x\to a} \frac{f(x) - f(a)} {x-a} - A$$ and thus the limit $$\lim_{x\to a} \frac{f(x) - f(a)} {x-a} $$ must exist and $A$ should be equal to that limit. It follows that $f'(a) $ exists and $A=f'(a) $ and from $(1)$ we have $B=f(a) - af'(a) $ so that $$g(x) =Ax+B=f(a) +f'(a) (x-a) $$ We have thus established that existence of best linear approximation implies that $f'(a) $ exists and the approximation function is given by a unique formula. The converse case where we know that $f'(a) $ exists is easily handled by defining $g(x) =f(a) +f'(a) (x-a) $ and showing that it meets the criterion for best linear approximation.