The problem: given any $F(x)$ and a point $P_1$, and an $\Delta \gt 0$, find an $P_2$ such that $L(x)$ is a straight line crossing both points which meets the requirement: $|F(x) - L(x)| \lt \Delta$ for any $x \in [P_1; P_2]$. So, in other words, all I have to do is to approximate any function with a linear fellow such that an error for any points belonging an interval is less than predefined value.
My attempt to solve the problem: $$L(x) = a * x + b$$ $$ a =\frac{P_{2y} - P_{1y}}{P_{2x} - P_{1x}}$$ Since both points are shared by $F(x)$ and $L(x)$: $$ P_{2y} = F(P_{2x}) $$ As such: $$ L(x) = \frac{F(P_{2x}) - F(P_{1x})}{P_{2x} - P_{1x}} * x + b $$ Which allows to reformulate the original formula above: $$\forall x \in [P_1; P_2] : |F(x) - \frac{F(P_{2x}) - F(P_{1x})}{P_{2x} - P_{1x}} * x - b| \lt \Delta$$
Since $P_1$ is predefined, I have to rewrite given inequality such that it gives me something like $P_{2x} \lt V$ where $V$ is some kind of positive value?
The question is: am I making things more complicated than they naturally are and is there any easier way to solve the problem? Did I miss something?