How to use Bezier curve to model one to one functions?

I recently have been looking at Bezier curves. I thought it would be useful in modeling the continuous function across a series of plotted points. So I started with $f(x)$ and $g(x)$ and real numbers $$x_0 < x_1 < x_2$$ where the domain of $f(x)$ is $$(-\infty,x_0]$$ and the domain of $g(x)$ is $$[x_2,\infty)$$ and we have real numbers $y_1, y_2, y_3$ each of which correspond to the data points $$(x_0,y_0),(x_1,y_1),(x_2,y_2)$$ and $$f(x_0)=y_0$$ $$g(x_2)=y_2$$ I want to generate to Bezier curves, $B_1$ and $B_2$ such that $B_1$ extends from $(x_0,y_0)$ to $(x_1,y_1)$ and $B_2$ extends from $(x_1,y_1)$ to $(x_2,y_2)$. I want to work within the limitation that $$\lim_{x\to x_0}f'(x) = \lim_{x\to x_0}B_1'(x)$$ $$\lim_{x\to x_1}B_1'(x) = \lim_{x\to x_1}B_2'(x)$$ $$\lim_{x\to x_2}B_2'(x) = \lim_{x\to x_2}g'(x)$$ I found the equation for the angle bisecting line running through $(x_1,y_1)$ for that is $$y=\left\{x_{0}\le x\le x_{2}\right\}\frac{\left(\sqrt{\left(y_{2}-y_{1}\right)^{2}+\left(x_{2}-x_{1}\right)^{2}}\left(y_{1}-y_{0}\right)+\sqrt{\left(y_{1}-y_{0}\right)^{2}+\left(x_{1}-x_{0}\right)^{2}}\left(y_{2}-y_{1}\right)\right)}{\left(\sqrt{\left(y_{2}-y_{1}\right)^{2}+\left(x_{2}-x_{1}\right)^{2}}\left(x_{1}-x_{0}\right)+\sqrt{\left(y_{1}-y_{0}\right)^{2}+\left(x_{1}-x_{0}\right)^{2}}\left(x_{2}-x_{1}\right)\right)}x+\frac{\left(\sqrt{\left(y_{2}-y_{1}\right)^{2}+\left(x_{2}-x_{1}\right)^{2}}\left(x_{1}y_{0}-y_{1}x_{0}\right)+\sqrt{\left(y_{1}-y_{0}\right)^{2}+\left(x_{1}-x_{0}\right)^{2}}\left(x_{2}y_{1}-y_{2}x_{1}\right)\right)}{\left(\sqrt{\left(y_{2}-y_{1}\right)^{2}+\left(x_{2}-x_{1}\right)^{2}}\left(x_{1}-x_{0}\right)+\sqrt{\left(y_{1}-y_{0}\right)^{2}+\left(x_{1}-x_{0}\right)^{2}}\left(x_{2}-x_{1}\right)\right)}$$ I figured that this would be relevant, but I am not quite sure where to go from here, other than the two starting curves $$((1-t)x_0+tx_1,(1-t)y_0+ty_1)$$ $$((1-t)x_1+tx_2,(1-t)y_1+ty_2)$$ where $0\leq t \leq 1$. Again, my main parameters are that $B_1$ and $B_2$ need to be one to one, and $$\lim_{x\to x_0}f'(x) = \lim_{x\to x_0}B_1'(x)$$ $$\lim_{x\to x_1}B_1'(x) = \lim_{x\to x_1}B_2'(x)$$ $$\lim_{x\to x_2}B_2'(x) = \lim_{x\to x_2}g'(x)$$


Solution 1:

You have the following data that you want to match: a value and first derivative at $x_0$, a value and first derivative at $x_2$, and a value at $x_1$. You want a function that interpolates these values, and you want it to be $C_1$ continuous at the middle point $x_1$.

The simplest solution is a cubic spline with “clamped” end-tangents. This will consist of two cubic segments that actually have a $C_2$ joint at $x_1$. You can think of the two cubic segments as (real-valued) Bézier curves, if you want. Conventional Bézier curves are parametric curves, i.e. functions with values in $\mathbb R^2$ or $\mathbb R^3$, so they’re not quite what you need.

In general, to construct a cubic spline, you have to solve a linear system of equations. But in your case the linear system will be trivially simple. Just look up cubic splines.

If you want to guarantee that the result will be monotone, or that it closely matches the piecewise linear interpolant, then life gets more complicated. There are things called “monotonicity-preserving” splines, and “splines under tension” that achieve these objectives. But, you might find that plain old cubic splines serve your purpose, without all this extra fuss.

Solution 2:

I was working through and I found a way to model the two Bezier curves I was looking for. Here is what I came up with; I used $f\left(x\right)=\left\{x\le x_{0}:\frac{1}{x^{2}}\right\}$ and $g\left(x\right)=\left\{x\ge x_{2}:\sin x\right\}$, but any function works. So then I have $$x_0<x_1<x_2$$ and $p_{0}=\left(x_{0},y_{0}\right)$, $p_{1}=\left(x_{1},y_{1}\right)$, $p_{2}=\left(x_{2},y_{2}\right)$ where $$y_{0}=f\left(x_{0}\right),y_{2}=g\left(x_{2}\right)$$ I then made some segments indicative of the slopes to frame the two Bezier curves. $$m_{x0}\left(x\right)=\left\{x_{0}\le x\le x_{1}:f'\left(x_{0}\right)\left(x-x_{0}\right)+y_{0}\right\}$$ $m_{x1}\left(x\right)=\left\{x_{0}\le x\le x_{2}:\frac{\left(\sqrt{\left(y_{2}-y_{1}\right)^{2}+\left(x_{2}-x_{1}\right)^{2}}\left(y_{1}-y_{0}\right)+\sqrt{\left(y_{1}-y_{0}\right)^{2}+\left(x_{1}-x_{0}\right)^{2}}\left(y_{2}-y_{1}\right)\right)x+\left(\sqrt{\left(y_{2}-y_{1}\right)^{2}+\left(x_{2}-x_{1}\right)^{2}}\left(x_{1}y_{0}-y_{1}x_{0}\right)+\sqrt{\left(y_{1}-y_{0}\right)^{2}+\left(x_{1}-x_{0}\right)^{2}}\left(x_{2}y_{1}-y_{2}x_{1}\right)\right)}{\left(\sqrt{\left(y_{2}-y_{1}\right)^{2}+\left(x_{2}-x_{1}\right)^{2}}\left(x_{1}-x_{0}\right)+\sqrt{\left(y_{1}-y_{0}\right)^{2}+\left(x_{1}-x_{0}\right)^{2}}\left(x_{2}-x_{1}\right)\right)}\right\}$ $$m_{x2}\left(x\right)=\left\{x_{1}\le x\le x_{2}:g'\left(x_{2}\right)\left(x-x_{2}\right)+y_{2}\right\}$$

The $m_{x1}\left(x\right)$ segment has the slope of the perpendicular bisector of $∠p_0p_1p_2$ and runs through $p_1$. I set this up to maintain continuity of the slope from the first Bezier curve to the second Bezier.

So, after that, I set up 4 points on the segments. $$a=\left(a_{x},a_{y}\right),b=\left(b_{x},b_{y}\right),c=\left(c_{x},c_{y}\right),d=\left(d_{x},d_{y}\right)$$ where $$x_0<a_x<x_1,x_0<b_x<x_1,x_1<c_x<x_2,x_1<d_x<x_2$$ and $$a_{y}=m_{x0}\left(a_{x}\right),b_{y}=m_{x1}\left(b_{x}\right)$$ $$c_{y}=m_{x1}\left(c_{x}\right),d_{y}=m_{x2}\left(d_{x}\right)$$

Using these points, I plotted in Desmos some basic segment curves to start with, given $0\leq t \leq1$, going from $x_0$ to $a$, $$\left(\left(1-t\right)x_{0}+ta_{x},\left(1-t\right)y_{0}+ta_{y}\right)$$ $a$ to $b$, $$\left(\left(1-t\right)a_{x}+tb_{x},\left(1-t\right)a_{y}+tb_{y}\right)$$ $b$ to $x_1$, $$\left(\left(1-t\right)b_{x}+tx_{1},\left(1-t\right)b_{y}+ty_{1}\right)$$ $x_1$ to $c$, $$\left(\left(1-t\right)x_{1}+tc_{x},\left(1-t\right)y_{1}+tc_{y}\right)$$ $c$ to $d$, $$\left(\left(1-t\right)c_{x}+td_{x},\left(1-t\right)c_{y}+td_{y}\right)$$ and $d$ to $x_2$, $$\left(\left(1-t\right)d_{x}+tx_{2},\left(1-t\right)d_{y}+ty_{2}\right)$$

Then, I took the whole $(1-t)*()+t*()$ principle to create curves from these segments.
$$ (1-t)*( x_0 \text{ to } a )+t*( a \text{ to } b ) =\left(\left(1-t\right)\left(\left(1-t\right)x_{0}+ta_{x}\right)+t\left(\left(1-t\right)a_{x}+tb_{x}\right),\left(1-t\right)\left(\left(1-t\right)y_{0}+ta_{y}\right)+t\left(\left(1-t\right)a_{y}+tb_{y}\right)\right) $$

$$ (1-t)*( a \text{ to } b )+t*( b \text{ to } x_1 )= \left(\left(1-t\right)\left(\left(1-t\right)a_{x}+tb_{x}\right)+t\left(\left(1-t\right)b_{x}+tx_{1}\right),\left(1-t\right)\left(\left(1-t\right)a_{y}+tb_{y}\right)+t\left(\left(1-t\right)b_{y}+ty_{1}\right)\right) $$

$$ (1-t)*( x_1 \text{ to } c )+t*( c \text{ to } d )= \left(\left(1-t\right)\left(\left(1-t\right)x_{1}+tc_{x}\right)+t\left(\left(1-t\right)c_{x}+td_{x}\right),\left(1-t\right)\left(\left(1-t\right)y_{1}+tc_{y}\right)+t\left(\left(1-t\right)c_{y}+td_{y}\right)\right) $$

$$ (1-t)*( c \text{ to } d )+t*( d \text{ to } x_2 )= \left(\left(1-t\right)\left(\left(1-t\right)c_{x}+td_{x}\right)+t\left(\left(1-t\right)d_{x}+tx_{2}\right),\left(1-t\right)\left(\left(1-t\right)c_{y}+td_{y}\right)+t\left(\left(1-t\right)d_{y}+ty_{2}\right)\right) $$

The final two curves resultant from combining these are $$ B_{1}=\left(\left(1-t\right)\left(\left(1-t\right)\left(\left(1-t\right)x_{0}+ta_{x}\right)+t\left(\left(1-t\right)a_{x}+tb_{x}\right)\right)+t\left(\left(1-t\right)\left(\left(1-t\right)a_{x}+tb_{x}\right)+t\left(\left(1-t\right)b_{x}+tx_{1}\right)\right),\left(1-t\right)\left(\left(1-t\right)\left(\left(1-t\right)y_{0}+ta_{y}\right)+t\left(\left(1-t\right)a_{y}+tb_{y}\right)\right)+t\left(\left(1-t\right)\left(\left(1-t\right)a_{y}+tb_{y}\right)+t\left(\left(1-t\right)b_{y}+ty_{1}\right)\right)\right) $$ and $$ B_{2}=\left(\left(1-t\right)\left(\left(1-t\right)\left(\left(1-t\right)x_{1}+tc_{x}\right)+t\left(\left(1-t\right)c_{x}+td_{x}\right)\right)+t\left(\left(1-t\right)\left(\left(1-t\right)c_{x}+td_{x}\right)+t\left(\left(1-t\right)d_{x}+tx_{2}\right)\right),\left(1-t\right)\left(\left(1-t\right)\left(\left(1-t\right)y_{1}+tc_{y}\right)+t\left(\left(1-t\right)c_{y}+td_{y}\right)\right)+t\left(\left(1-t\right)\left(\left(1-t\right)c_{y}+td_{y}\right)+t\left(\left(1-t\right)d_{y}+ty_{2}\right)\right)\right) $$

Cleaned up, we get two sets of parametric equations, the first describing $B_1$, the second describing $B_2$.

$$ x_{t_{B_1}}=x_{0}-\left(x_{0}-a_{x}\right)\cdot3t+\left(x_{0}-2a_{x}+b_{x}\right)\cdot3t^{2}-\left(x_{0}-3a_{x}+3b_{x}-x_{1}\right)\cdot t^{3} $$

$$ y_{t_{B_1}}=y_{0}-\left(y_{0}-a_{y}\right)\cdot3t+\left(y_{0}-2a_{y}+b_{y}\right)\cdot3t^{2}-\left(y_{0}-3a_{y}+3b_{y}-y_{1}\right)\cdot t^{3} $$ and $$ x_{t_{B_2}}=x_{1}-\left(x_{1}-c_{x}\right)\cdot3t+\left(x_{1}-2c_{x}+d_{x}\right)\cdot3t^{2}-\left(x_{1}-3c_{x}+3d_{x}-x_{2}\right)\cdot t^{3} $$

$$ y_{t_{B_2}}=y_{1}-\left(y_{1}-c_{y}\right)\cdot3t+\left(y_{1}-2c_{y}+d_{y}\right)\cdot3t^{2}-\left(y_{1}-3c_{y}+3d_{y}-y_{2}\right)\cdot t^{3} $$

Now, all that is left is to prove that these two curves are one to one, and that $$\lim_{x\to {x_0}}{f'(x)}=\lim_{x\to {x_0}} {\frac{\frac{d}{dt}y_{t_{B_1}}}{\frac{d}{dt}x_{t_{B_1}}}}$$

$$\lim_{x\to {x_1}}{\frac{\frac{d}{dt}y_{t_{B_1}}}{\frac{d}{dt}x_{t_{B_1}}}} = \lim_{x\to {x_1}}{\frac{\frac{d}{dt}y_{t_{B_2}}}{\frac{d}{dt}x_{t_{B_2}}}}$$

$$\lim_{x\to {x_2}}{g'(x)}=\lim_{x\to {x_2}} {\frac{\frac{d}{dt}y_{t_{B_2}}}{\frac{d}{dt}x_{t_{B_2}}}}$$

To prove that the curves are one to one, we simply need to establish that as $t$ grows larger, so does the $x$ values. That is to say, $$\frac{d}{dt}{x_{t_{B_1}}}>0 \text{ } and \text{ } \frac{d}{dt}{x_{t_{B_2}}}>0$$

Taking the derivative with respect to $t$, we get $$\frac{d}{dt}x_{t_{B_1}}=3\left(\left(a_{x}-x_{0}\right)+\left(x_{0}-2a_{x}+b_{x}\right)2t+\left(x_{1}-x_{0}+3a_{x}-3b_{x}\right)t^{2}\right)$$ Note that $x_0<a_x<b_x<x_1$ must be true or $x_0<b_x<a_x<x_1$ or $b_x=a_x$. In the first case, we can rewrite $a_x$,$b_x$ and $x_1$ as

  • $a_x=x_0+\alpha$

  • $b_x=x_0+\alpha+\beta$

  • $x_1=x_0+\alpha+\beta+\gamma$ $$$$ and in the second case we can rewrite them as

  • $b_x=x_0+\alpha$

  • $a_x=x_0+\alpha+\beta$

  • $x_1=x_0+\alpha+\beta+\gamma$

where $\alpha,\beta,$and$\gamma$ are positive constants representing the differential between values.

  1. Case 1 $$\frac{d}{dt}x_{t_{B_1}}=3\left(\left(x_{0}+\alpha+\beta+γ\right)t^{2}+\left(x_{0}+\alpha+\beta\right)\left(-3t^{2}+2t\right)+\left(x_{0}+\alpha\right)\left(3t^{2}-4t+1\right)+x_{0}\left(-t^{2}+2t-1\right)\right)$$ $$0<3\left(\left(x_{0}+\alpha+\beta+γ\right)t^{2}+\left(x_{0}+\alpha+\beta\right)\left(-3t^{2}+2t\right)+\left(x_{0}+\alpha\right)\left(3t^{2}-4t+1\right)+x_{0}\left(-t^{2}+2t-1\right)\right)$$ $$0<x_{0}\left(\left(t^{2}\right)+\left(-3t^{2}+2t\right)+\left(3t^{2}-4t+1\right)+\left(-t^{2}+2t-1\right)\right)+\left(\alpha+\beta+γ\right)t^{2}+\left(\alpha+\beta\right)\left(-3t^{2}+2t\right)+\left(\alpha\right)\left(3t^{2}-4t+1\right)$$ $$0<x_{0}\cdot0+\left(\alpha+\beta+γ\right)t^{2}+\left(\alpha+\beta\right)\left(-3t^{2}+2t\right)+\left(\alpha\right)\left(3t^{2}-4t+1\right)$$ $$0<\alpha\left(t^{2}+\left(-3t^{2}+2t\right)+\left(3t^{2}-4t+1\right)\right)+\beta\left(t^{2}+\left(-3t^{2}+2t\right)\right)+\left(γ\right)t^{2}$$ $$0<\alpha\left(t^{2}-2t+1\right)+\beta\left(2t-2t^{2}\right)+γt^{2}$$ $$0<\alpha\cdot\left(1-t\right)^{2}+2\beta\cdot\left(t\right)\left(1-t\right)+γt^{2}$$ 2.Case 2 $$\frac{d}{dt}x_{t_{B_1}}=3\left(x_{1}t^{2}+a_{x}\left(3t^{2}-4t+1\right)+b_{x}\left(-3t^{2}+2t\right)+x_{0}\left(-t^{2}+2t-1\right)\right)$$ $$\frac{d}{dt}x_{t_{B_1}}=3\left(\left(x_{0}+\alpha+\beta+γ\right)t^{2}+\left(x_{0}+\alpha+\beta\right)\left(3t^{2}-4t+1\right)+\left(x_{0}+\alpha\right)\left(-3t^{2}+2t\right)+x_{0}\left(-t^{2}+2t-1\right)\right)$$ $$0<\left(x_{0}+\alpha+\beta+γ\right)t^{2}+\left(x_{0}+\alpha+\beta\right)\left(3t^{2}-4t+1\right)+\left(x_{0}+\alpha\right)\left(-3t^{2}+2t\right)+x_{0}\left(-t^{2}+2t-1\right)$$ $$0<x_{0}\left(t^{2}+\left(3t^{2}-4t+1\right)+\left(-3t^{2}+2t\right)+\left(-t^{2}+2t-1\right)\right)+\alpha\left(t^{2}+\left(3t^{2}-4t+1\right)+\left(-3t^{2}+2t\right)\right)+\beta\left(t^{2}+\left(3t^{2}-4t+1\right)\right)+\left(γ\right)t^{2}$$ $$0<x_{0}\cdot0+\alpha\left(t^{2}-2t+1\right)+\beta\left(4t^{2}-4t+1\right)+γt^{2}$$ $$0<x_{0}\cdot0+\alpha\left(1-t\right)^{2}+\beta\left(1-2t\right)^{2}+γt^{2}$$ As we can see, both cases result in a sum of positive constants with positive coefficients yielding a positive result. The case of $a_x=b_x$ is accounted for with $\beta=0$ That said, in order to obtain a positive $\frac{d}{dt}{t_{B_1}}$, $\alpha$ must be greater than zero, because otherwise at $t=0$ the whole derivative would equal zero.

As far as proving that $$\lim_{x\to {x_0}}{f'(x)}=\lim_{x\to {x_0}} {\frac{\frac{d}{dt}y_{t_{B_1}}}{\frac{d}{dt}x_{t_{B_1}}}}$$

$$\lim_{x\to {x_1}}{\frac{\frac{d}{dt}y_{t_{B_1}}}{\frac{d}{dt}x_{t_{B_1}}}} = \lim_{x\to {x_1}}{\frac{\frac{d}{dt}y_{t_{B_2}}}{\frac{d}{dt}x_{t_{B_2}}}}$$

$$\lim_{x\to {x_2}}{g'(x)}=\lim_{x\to {x_2}} {\frac{\frac{d}{dt}y_{t_{B_2}}}{\frac{d}{dt}x_{t_{B_2}}}}$$

First I'll set up the parametric equations modeling the slope of the two Bezier curves. To find that, we use for the new x values$x_t=x_t$, and the new y values $y'_t=\frac{\frac{d}{dt}{y_t}}{\frac{d}{dt}{x_t}}$

  • Derivative of $B_1$ $$x_{t_{B_1}}=x_{0}-\left(x_{0}-a_{x}\right)\cdot3t+\left(x_{0}-2a_{x}+b_{x}\right)\cdot3t^{2}-\left(x_{0}-3a_{x}+3b_{x}-x_{1}\right)\cdot t^{3}$$ $$y'_{t_{B_1}}=\frac{\frac{d}{dt}{(y_{0}-\left(y_{0}-a_{y}\right)\cdot3t+\left(y_{0}-2a_{y}+b_{y}\right)\cdot3t^{2}-\left(y_{0}-3a_{y}+3b_{y}-y_{1}\right)\cdot t^{3})}}{\frac{d}{dt}{x_{0}-\left(x_{0}-a_{x}\right)\cdot3t+\left(x_{0}-2a_{x}+b_{x}\right)\cdot3t^{2}-\left(x_{0}-3a_{x}+3b_{x}-x_{1}\right)\cdot t^{3}}}$$ $$y'_{t_{B_1}}=\frac{-\left(y_{0}-a_{y}\right)\cdot3+\left(y_{0}-2a_{y}+b_{y}\right)\cdot6t-\left(y_{0}-3a_{y}+3b_{y}-y_{1}\right)\cdot3t^{2}}{-\left(x_{0}-a_{x}\right)\cdot3+\left(x_{0}-2a_{x}+b_{x}\right)\cdot6t-\left(x_{0}-3a_{x}+3b_{x}-x_{1}\right)\cdot3t^{2}}$$ $$y'_{t_{B_1}}=\frac{\left(y_{0}-a_{y}\right)-\left(y_{0}-2a_{y}+b_{y}\right)\cdot2t+\left(y_{0}-3a_{y}+3b_{y}-y_{1}\right)\cdot t^{2}}{\left(x_{0}-a_{x}\right)-\left(x_{0}-2a_{x}+b_{x}\right)\cdot2t+\left(x_{0}-3a_{x}+3b_{x}-x_{1}\right)\cdot t^{2}}$$

Right, as we can see in the above equation for $x_t$ for $B_1$, $x_t$ approaches $x_0$ as $t$ approaches zero. Also, $x_t$ approaches $x_1$ when $t$ approaches 1. $$\lim_{x\to {x_0}} {\frac{\frac{d}{dt}y_{t_{B_1}}}{\frac{d}{dt}x_{t_{B_1}}}}=\lim_{t\to {0}} {\frac{\frac{d}{dt}y_{t_{B_1}}}{\frac{d}{dt}x_{t_{B_1}}}}=\lim_{t\to {0}} \frac{\left(y_{0}-a_{y}\right)-\left(y_{0}-2a_{y}+b_{y}\right)\cdot2t+\left(y_{0}-3a_{y}+3b_{y}-y_{1}\right)\cdot t^{2}}{\left(x_{0}-a_{x}\right)-\left(x_{0}-2a_{x}+b_{x}\right)\cdot2t+\left(x_{0}-3a_{x}+3b_{x}-x_{1}\right)\cdot t^{2}}$$ $$=\frac{\left(y_{0}-a_{y}\right)}{\left(x_{0}-a_{x}\right)}$$ We established in the beginning that $a_{y}=m_{x_0}\left(a_{x}\right)$. $$\lim_{x\to {x_0}} {\frac{\frac{d}{dt}y_{t_{B_1}}}{\frac{d}{dt}x_{t_{B_1}}}}=\frac{\left(y_{0}-m_{x_0}\left(a_{x}\right)\right)}{\left(x_{0}-a_{x}\right)}$$ and we established

$m_{x_0}\left(x\right)=\left\{x_{0}\le x\le x_{1}:f'\left(x_{0}\right)\left(x-x_{0}\right)+y_{0}\right\}$ so,

$$m_{x_0}\left(a_{x}\right)=f'(x_{0})(a_{x}-x_{0})+y_{0}$$

$$\lim_{x\to {x_0}} {\frac{\frac{d}{dt}y_{t_{B_1}}}{\frac{d}{dt}x_{t_{B_1}}}}=\frac{\left(y_{0}-(f'(x_{0})(a_{x}-x_{0})+y_{0})\right) }{\left(x_{0}-a_{x}\right)}$$ $$\lim_{x\to {x_0}} {\frac{\frac{d}{dt}y_{t_{B_1}}}{\frac{d}{dt}x_{t_{B_1}}}}=\frac{\left(-(f'(x_{0})(a_{x}-x_{0}))\right) }{\left(x_{0}-a_{x}\right)}$$ $$\lim_{x\to {x_0}} {\frac{\frac{d}{dt}y_{t_{B_1}}}{\frac{d}{dt}x_{t_{B_1}}}}=\frac{\left(-(f'(x_{0})(a_{x}-x_{0}))\right) }{\left(x_{0}-a_{x}\right)}=f'(x_0)$$ So, the first limit matches up. Next, as $t$ approaches $1$, $x_t$ approaches $x_1$ So, we calculate that out. $$\lim_{x\to {x_1}} {\frac{\frac{d}{dt}y_{t_{B_1}}}{\frac{d}{dt}x_{t_{B_1}}}}=\lim_{t\to {1}} {\frac{\frac{d}{dt}y_{t_{B_1}}}{\frac{d}{dt}x_{t_{B_1}}}}=\lim_{t\to {1}}{(\frac{\left(y_{0}-a_{y}\right)-\left(y_{0}-2a_{y}+b_{y}\right)\cdot2t+\left(y_{0}-3a_{y}+3b_{y}-y_{1}\right)\cdot t^{2}}{\left(x_{0}-a_{x}\right)-\left(x_{0}-2a_{x}+b_{x}\right)\cdot2t+\left(x_{0}-3a_{x}+3b_{x}-x_{1}\right)\cdot t^{2}})}$$ $$=\frac{\left(y_{0}-a_{y}\right)-\left(y_{0}-2a_{y}+b_{y}\right)\cdot2\cdot1+\left(y_{0}-3a_{y}+3b_{y}-y_{1}\right)\cdot1^{2}}{\left(x_{0}-a_{x}\right)-\left(x_{0}-2a_{x}+b_{x}\right)\cdot2\cdot1+\left(x_{0}-3a_{x}+3b_{x}-x_{1}\right)\cdot1^{2}}$$ $$=\frac{y_{1}-b_{y}}{x_{1}-b_{x}}$$ Substituting $y_1$ and $b_y$ with values calculated from $m_{x_{1}}\left(x \right)$ we get $$=\frac{m_{x_{1}}\left(x_{1}\right)-m_{x_{1}}\left(b_{x}\right)}{x_{1}-b_{x}}$$ $$=\frac{\left(\frac{\left(\sqrt{\left(y_{2}-y_{1}\right)^{2}+\left(x_{2}-x_{1}\right)^{2}}\left(y_{1}-y_{0}\right)+\sqrt{\left(y_{1}-y_{0}\right)^{2}+\left(x_{1}-x_{0}\right)^{2}}\left(y_{2}-y_{1}\right)\right)x_{1}+\left(\sqrt{\left(y_{2}-y_{1}\right)^{2}+\left(x_{2}-x_{1}\right)^{2}}\left(x_{1}y_{0}-y_{1}x_{0}\right)+\sqrt{\left(y_{1}-y_{0}\right)^{2}+\left(x_{1}-x_{0}\right)^{2}}\left(x_{2}y_{1}-y_{2}x_{1}\right)\right)}{\left(\sqrt{\left(y_{2}-y_{1}\right)^{2}+\left(x_{2}-x_{1}\right)^{2}}\left(x_{1}-x_{0}\right)+\sqrt{\left(y_{1}-y_{0}\right)^{2}+\left(x_{1}-x_{0}\right)^{2}}\left(x_{2}-x_{1}\right)\right)}\right)-\left(\frac{\left(\sqrt{\left(y_{2}-y_{1}\right)^{2}+\left(x_{2}-x_{1}\right)^{2}}\left(y_{1}-y_{0}\right)+\sqrt{\left(y_{1}-y_{0}\right)^{2}+\left(x_{1}-x_{0}\right)^{2}}\left(y_{2}-y_{1}\right)\right)b_{x}+\left(\sqrt{\left(y_{2}-y_{1}\right)^{2}+\left(x_{2}-x_{1}\right)^{2}}\left(x_{1}y_{0}-y_{1}x_{0}\right)+\sqrt{\left(y_{1}-y_{0}\right)^{2}+\left(x_{1}-x_{0}\right)^{2}}\left(x_{2}y_{1}-y_{2}x_{1}\right)\right)}{\left(\sqrt{\left(y_{2}-y_{1}\right)^{2}+\left(x_{2}-x_{1}\right)^{2}}\left(x_{1}-x_{0}\right)+\sqrt{\left(y_{1}-y_{0}\right)^{2}+\left(x_{1}-x_{0}\right)^{2}}\left(x_{2}-x_{1}\right)\right)}\right)}{x_{1}-b_{x}}$$ $$=\frac{\left(\frac{\left(\sqrt{\left(y_{2}-y_{1}\right)^{2}+\left(x_{2}-x_{1}\right)^{2}}\left(y_{1}-y_{0}\right)+\sqrt{\left(y_{1}-y_{0}\right)^{2}+\left(x_{1}-x_{0}\right)^{2}}\left(y_{2}-y_{1}\right)\right)x_{1}}{\left(\sqrt{\left(y_{2}-y_{1}\right)^{2}+\left(x_{2}-x_{1}\right)^{2}}\left(x_{1}-x_{0}\right)+\sqrt{\left(y_{1}-y_{0}\right)^{2}+\left(x_{1}-x_{0}\right)^{2}}\left(x_{2}-x_{1}\right)\right)}\right)-\left(\frac{\left(\sqrt{\left(y_{2}-y_{1}\right)^{2}+\left(x_{2}-x_{1}\right)^{2}}\left(y_{1}-y_{0}\right)+\sqrt{\left(y_{1}-y_{0}\right)^{2}+\left(x_{1}-x_{0}\right)^{2}}\left(y_{2}-y_{1}\right)\right)b_{x}}{\left(\sqrt{\left(y_{2}-y_{1}\right)^{2}+\left(x_{2}-x_{1}\right)^{2}}\left(x_{1}-x_{0}\right)+\sqrt{\left(y_{1}-y_{0}\right)^{2}+\left(x_{1}-x_{0}\right)^{2}}\left(x_{2}-x_{1}\right)\right)}\right)}{x_{1}-b_{x}}$$ $$=\frac{\left(\frac{\left(\sqrt{\left(y_{2}-y_{1}\right)^{2}+\left(x_{2}-x_{1}\right)^{2}}\left(y_{1}-y_{0}\right)+\sqrt{\left(y_{1}-y_{0}\right)^{2}+\left(x_{1}-x_{0}\right)^{2}}\left(y_{2}-y_{1}\right)\right)}{\left(\sqrt{\left(y_{2}-y_{1}\right)^{2}+\left(x_{2}-x_{1}\right)^{2}}\left(x_{1}-x_{0}\right)+\sqrt{\left(y_{1}-y_{0}\right)^{2}+\left(x_{1}-x_{0}\right)^{2}}\left(x_{2}-x_{1}\right)\right)}\right)\left(x_{1}-b_{x}\right)}{x_{1}-b_{x}}$$ $$=\frac{\sqrt{\left(y_{2}-y_{1}\right)^{2}+\left(x_{2}-x_{1}\right)^{2}}\left(y_{1}-y_{0}\right)+\sqrt{\left(y_{1}-y_{0}\right)^{2}+\left(x_{1}-x_{0}\right)^{2}}\left(y_{2}-y_{1}\right)}{\sqrt{\left(y_{2}-y_{1}\right)^{2}+\left(x_{2}-x_{1}\right)^{2}}\left(x_{1}-x_{0}\right)+\sqrt{\left(y_{1}-y_{0}\right)^{2}+\left(x_{1}-x_{0}\right)^{2}}\left(x_{2}-x_{1}\right)}$$ Which as mentioned earlier, was the slope of the perpendicular bisector I set up earlier.

  • Derivative of $B_2$ So, we do the same thing with $B_2$. Here we'll be using $$x_t=x_{1}-\left(x_{1}-c_{x}\right)\cdot3t+\left(x_{1}-2c_{x}+d_{x}\right)\cdot3t^{2}-\left(x_{1}-3c_{x}+3d_{x}-x_{2}\right)\cdot t^{3}$$ and $$y'_t=\frac{-\left(y_{1}-c_{y}\right)\cdot3+\left(y_{1}-2c_{y}+d_{y}\right)\cdot6t-\left(y_{1}-3c_{y}+3d_{y}-y_{2}\right)\cdot3t^{2}}{-\left(x_{1}-c_{x}\right)\cdot3+\left(x_{1}-2c_{x}+d_{x}\right)\cdot6t-\left(x_{1}-3c_{x}+3d_{x}-x_{2}\right)\cdot3t^{2}}$$ $$=\frac{\left(y_{1}-c_{y}\right)-\left(y_{1}-2c_{y}+d_{y}\right)\cdot2t+\left(y_{1}-3c_{y}+3d_{y}-y_{2}\right)\cdot t^{2}}{\left(x_{1}-c_{x}\right)-\left(x_{1}-2c_{x}+d_{x}\right)\cdot2t+\left(x_{1}-3c_{x}+3d_{x}-x_{2}\right)\cdot t^{2}}$$ which we find using the same process for calculating parametric derivatives gone over with the first Bezier curve. In this case, we see that as $x_t$ approaches $x_1$, $t$ approaches $0$. As $x_t$ approaches $x_1$, $t$ approaches $1$. So, we set out to calculate $$\lim_{x\to {x_1}}{\frac{\frac{d}{dt}y_{t_{B_2}}}{\frac{d}{dt}x_{t_{B_2}}}}=\lim_{t\to {0}}{\frac{\frac{d}{dt}y_{t_{B_2}}}{\frac{d}{dt}x_{t_{B_2}}}}$$ and $$\lim_{x\to {x_2}}{\frac{\frac{d}{dt}y_{t_{B_2}}}{\frac{d}{dt}x_{t_{B_2}}}}=\lim_{t\to {1}}{\frac{\frac{d}{dt}y_{t_{B_2}}}{\frac{d}{dt}x_{t_{B_2}}}}$$ In the case where $t$ approaches $0$, $$\lim_{t\to {0}}{\frac{\frac{d}{dt}y_{t_{B_2}}}{\frac{d}{dt}x_{t_{B_2}}}}=\lim_{t\to {0}}{(\frac{\left(y_{1}-c_{y}\right)-\left(y_{1}-2c_{y}+d_{y}\right)\cdot2t+\left(y_{1}-3c_{y}+3d_{y}-y_{2}\right)\cdot t^{2}}{\left(x_{1}-c_{x}\right)-\left(x_{1}-2c_{x}+d_{x}\right)\cdot2t+\left(x_{1}-3c_{x}+3d_{x}-x_{2}\right)\cdot t^{2}})}$$ $$=\lim_{t\to {0}}{\frac{y_{1}-c_{y}}{x_{1}-c_{x}}}$$ And similar to the case of $B_1$, $$=\frac{m_{x_1}\left(x_{1}\right)-m_{x_1}\left(c_{x}\right)}{x_{1}-c_{x}}$$ $$=\frac{\left(\frac{\left(\sqrt{\left(y_{2}-y_{1}\right)^{2}+\left(x_{2}-x_{1}\right)^{2}}\left(y_{1}-y_{0}\right)+\sqrt{\left(y_{1}-y_{0}\right)^{2}+\left(x_{1}-x_{0}\right)^{2}}\left(y_{2}-y_{1}\right)\right)x_{1}+\left(\sqrt{\left(y_{2}-y_{1}\right)^{2}+\left(x_{2}-x_{1}\right)^{2}}\left(x_{1}y_{0}-y_{1}x_{0}\right)+\sqrt{\left(y_{1}-y_{0}\right)^{2}+\left(x_{1}-x_{0}\right)^{2}}\left(x_{2}y_{1}-y_{2}x_{1}\right)\right)}{\left(\sqrt{\left(y_{2}-y_{1}\right)^{2}+\left(x_{2}-x_{1}\right)^{2}}\left(x_{1}-x_{0}\right)+\sqrt{\left(y_{1}-y_{0}\right)^{2}+\left(x_{1}-x_{0}\right)^{2}}\left(x_{2}-x_{1}\right)\right)}\right)-\left(\frac{\left(\sqrt{\left(y_{2}-y_{1}\right)^{2}+\left(x_{2}-x_{1}\right)^{2}}\left(y_{1}-y_{0}\right)+\sqrt{\left(y_{1}-y_{0}\right)^{2}+\left(x_{1}-x_{0}\right)^{2}}\left(y_{2}-y_{1}\right)\right)c_{x}+\left(\sqrt{\left(y_{2}-y_{1}\right)^{2}+\left(x_{2}-x_{1}\right)^{2}}\left(x_{1}y_{0}-y_{1}x_{0}\right)+\sqrt{\left(y_{1}-y_{0}\right)^{2}+\left(x_{1}-x_{0}\right)^{2}}\left(x_{2}y_{1}-y_{2}x_{1}\right)\right)}{\left(\sqrt{\left(y_{2}-y_{1}\right)^{2}+\left(x_{2}-x_{1}\right)^{2}}\left(x_{1}-x_{0}\right)+\sqrt{\left(y_{1}-y_{0}\right)^{2}+\left(x_{1}-x_{0}\right)^{2}}\left(x_{2}-x_{1}\right)\right)}\right)}{x_{1}-c_{x}}$$ $$=\frac{\left(\frac{\left(\sqrt{\left(y_{2}-y_{1}\right)^{2}+\left(x_{2}-x_{1}\right)^{2}}\left(y_{1}-y_{0}\right)+\sqrt{\left(y_{1}-y_{0}\right)^{2}+\left(x_{1}-x_{0}\right)^{2}}\left(y_{2}-y_{1}\right)\right)x_{1}}{\left(\sqrt{\left(y_{2}-y_{1}\right)^{2}+\left(x_{2}-x_{1}\right)^{2}}\left(x_{1}-x_{0}\right)+\sqrt{\left(y_{1}-y_{0}\right)^{2}+\left(x_{1}-x_{0}\right)^{2}}\left(x_{2}-x_{1}\right)\right)}\right)-\left(\frac{\left(\sqrt{\left(y_{2}-y_{1}\right)^{2}+\left(x_{2}-x_{1}\right)^{2}}\left(y_{1}-y_{0}\right)+\sqrt{\left(y_{1}-y_{0}\right)^{2}+\left(x_{1}-x_{0}\right)^{2}}\left(y_{2}-y_{1}\right)\right)c_{x}}{\left(\sqrt{\left(y_{2}-y_{1}\right)^{2}+\left(x_{2}-x_{1}\right)^{2}}\left(x_{1}-x_{0}\right)+\sqrt{\left(y_{1}-y_{0}\right)^{2}+\left(x_{1}-x_{0}\right)^{2}}\left(x_{2}-x_{1}\right)\right)}\right)}{x_{1}-c_{x}}$$ $$=\frac{\left(\frac{\left(\sqrt{\left(y_{2}-y_{1}\right)^{2}+\left(x_{2}-x_{1}\right)^{2}}\left(y_{1}-y_{0}\right)+\sqrt{\left(y_{1}-y_{0}\right)^{2}+\left(x_{1}-x_{0}\right)^{2}}\left(y_{2}-y_{1}\right)\right)}{\left(\sqrt{\left(y_{2}-y_{1}\right)^{2}+\left(x_{2}-x_{1}\right)^{2}}\left(x_{1}-x_{0}\right)+\sqrt{\left(y_{1}-y_{0}\right)^{2}+\left(x_{1}-x_{0}\right)^{2}}\left(x_{2}-x_{1}\right)\right)}\right)\left(x_{1}-c_{x}\right)}{x_{1}-c_{x}}$$ $$=\frac{\left(\sqrt{\left(y_{2}-y_{1}\right)^{2}+\left(x_{2}-x_{1}\right)^{2}}\left(y_{1}-y_{0}\right)+\sqrt{\left(y_{1}-y_{0}\right)^{2}+\left(x_{1}-x_{0}\right)^{2}}\left(y_{2}-y_{1}\right)\right)}{\left(\sqrt{\left(y_{2}-y_{1}\right)^{2}+\left(x_{2}-x_{1}\right)^{2}}\left(x_{1}-x_{0}\right)+\sqrt{\left(y_{1}-y_{0}\right)^{2}+\left(x_{1}-x_{0}\right)^{2}}\left(x_{2}-x_{1}\right)\right)}$$ As we can see, this is equal to the slope of $B_1$ as $x$ approaches $x_1$. So far, we have established that $$\lim_{x\to {x_0}}{f'(x)}=\lim_{x\to {x_0}} {\frac{\frac{d}{dt}y_{t_{B_1}}}{\frac{d}{dt}x_{t_{B_1}}}}$$ and $$\lim_{x\to {x_1}}{\frac{\frac{d}{dt}y_{t_{B_1}}}{\frac{d}{dt}x_{t_{B_1}}}} = \lim_{x\to {x_1}}{\frac{\frac{d}{dt}y_{t_{B_2}}}{\frac{d}{dt}x_{t_{B_2}}}}$$

Now, in order to prove $$\lim_{x\to {x_2}}{g'(x)}=\lim_{x\to {x_2}} {\frac{\frac{d}{dt}y_{t_{B_2}}}{\frac{d}{dt}x_{t_{B_2}}}}$$ we have $t$ approach 1. $$\lim_{x\to {x_2}} {\frac{\frac{d}{dt}y_{t_{B_2}}}{\frac{d}{dt}x_{t_{B_2}}}}=\lim_{t\to {1}} {\frac{\frac{d}{dt}y_{t_{B_2}}}{\frac{d}{dt}x_{t_{B_2}}}}$$ $$=\lim_{t\to {1}}{(\frac{\left(y_{1}-c_{y}\right)-\left(y_{1}-2c_{y}+d_{y}\right)\cdot2t+\left(y_{1}-3c_{y}+3d_{y}-y_{2}\right)\cdot t^{2}}{\left(x_{1}-c_{x}\right)-\left(x_{1}-2c_{x}+d_{x}\right)\cdot2t+\left(x_{1}-3c_{x}+3d_{x}-x_{2}\right)\cdot t^{2}})}$$ $$=\frac{y_{2}-d_{y}}{x_{2}-d_{x}}$$ And here we calculate $d_y$ using $m_{x_2}\left(d_{x}\right)$ $$=\frac{y_{2}-m_{x_2}\left(d_{x}\right)}{x_{2}-d_{x}}$$ $$=\frac{y_{2}-\left(g'\left(x_{2}\right)\left(d_{x}-x_{2}\right)+y_{2}\right)}{x_{2}-d_{x}}$$ $$=\frac{g'\left(x_{2}\right)\cdot\left(x_{2}-d_{x}\right)}{x_{2}-d_{x}}$$ $$=g'\left(x_{2}\right)$$ Thus showing that $$\lim_{x\to {x_2}}{g'(x)}=\lim_{x\to {x_2}} {\frac{\frac{d}{dt}y_{t_{B_2}}}{\frac{d}{dt}x_{t_{B_2}}}}$$

In summary,

  • $f(x)$ is a continuous function with a domain of $(-\infty,x_0]$ and a derivative $f'(x)$ with a domain of $(-\infty,x_0]$.
  • $g(x)$ is a continuous function with a domain of $(x_2,\infty]$ and a derivative $g'(x)$ with a domain of $(x_2,\infty]$.
  • $x_0<x_1<x_2$
  • $y_1$ is a real number.
  • $x_0<a_x<x_1$ , $x_0<b_x<x_1$
  • $x_1<c_x<x_2$ , $x_1<d_x<x_2$
  • $y_{0}=f\left(x_{0}\right)$ , $y_{2}=g\left(x_{2}\right)$
  • $a_y$ exists such that $(a_x,a_y)$ lies on the line $y=f'\left(x_{0}\right)\left(x-x_{0}\right)+y_{0}$
  • $b_y$ and $c_y$ exist such that $(b_x,b_y)$ and $(c_x,c_y)$ lie on the perpendicular bisector of $∠(x_0,y_0)(x_1,y_1)(x_2,y_2)$
  • $d_y$ exists such that $(d_x,d_y)$ lies on the line $y=g'\left(x_{2}\right)\left(x-x_{2}\right)+y_{2}$
  • $B_1$ is represented by the parametric equations $$ x_{t_{B_1}}=x_{0}-\left(x_{0}-a_{x}\right)\cdot3t+\left(x_{0}-2a_{x}+b_{x}\right)\cdot3t^{2}-\left(x_{0}-3a_{x}+3b_{x}-x_{1}\right)\cdot t^{3} $$

$$ y_{t_{B_1}}=y_{0}-\left(y_{0}-a_{y}\right)\cdot3t+\left(y_{0}-2a_{y}+b_{y}\right)\cdot3t^{2}-\left(y_{0}-3a_{y}+3b_{y}-y_{1}\right)\cdot t^{3} $$

  • $B_2$ is represented by the parametric equations $$ x_{t_{B_2}}=x_{1}-\left(x_{1}-c_{x}\right)\cdot3t+\left(x_{1}-2c_{x}+d_{x}\right)\cdot3t^{2}-\left(x_{1}-3c_{x}+3d_{x}-x_{2}\right)\cdot t^{3} $$

$$ y_{t_{B_2}}=y_{1}-\left(y_{1}-c_{y}\right)\cdot3t+\left(y_{1}-2c_{y}+d_{y}\right)\cdot3t^{2}-\left(y_{1}-3c_{y}+3d_{y}-y_{2}\right)\cdot t^{3} $$

  • The slope of $B_1$ is represented by the parametric equations $$ x_{t_{B_1}}=x_{0}-\left(x_{0}-a_{x}\right)\cdot3t+\left(x_{0}-2a_{x}+b_{x}\right)\cdot3t^{2}-\left(x_{0}-3a_{x}+3b_{x}-x_{1}\right)\cdot t^{3} $$

$$ y'_{t_{B_1}}=\frac{\left(y_{0}-a_{y}\right)-\left(y_{0}-2a_{y}+b_{y}\right)\cdot2t+\left(y_{0}-3a_{y}+3b_{y}-y_{1}\right)\cdot t^{2}}{\left(x_{0}-a_{x}\right)-\left(x_{0}-2a_{x}+b_{x}\right)\cdot2t+\left(x_{0}-3a_{x}+3b_{x}-x_{1}\right)\cdot t^{2}} $$

  • The slope of $B_2$ is represented by the parametric equations $$ x_{t_{B_2}}=x_{1}-\left(x_{1}-c_{x}\right)\cdot3t+\left(x_{1}-2c_{x}+d_{x}\right)\cdot3t^{2}-\left(x_{1}-3c_{x}+3d_{x}-x_{2}\right)\cdot t^{3} $$

$$ y'_{t_{B_2}}=\frac{\left(y_{1}-c_{y}\right)-\left(y_{1}-2c_{y}+d_{y}\right)\cdot2t+\left(y_{1}-3c_{y}+3d_{y}-y_{2}\right)\cdot t^{2}}{\left(x_{1}-c_{x}\right)-\left(x_{1}-2c_{x}+d_{x}\right)\cdot2t+\left(x_{1}-3c_{x}+3d_{x}-x_{2}\right)\cdot t^{2}} $$

  • $B_1$ and $B_2$ are one to one functions.
  • $$\lim_{x\to {x_0}}{f'(x)}=\lim_{x\to {x_0}} {\frac{\frac{d}{dt}y_{t_{B_1}}}{\frac{d}{dt}x_{t_{B_1}}}}$$
  • $$\lim_{x\to {x_1}}{\frac{\frac{d}{dt}y_{t_{B_1}}}{\frac{d}{dt}x_{t_{B_1}}}}=\lim_{x\to {x_1}}{\frac{\frac{d}{dt}y_{t_{B_2}}}{\frac{d}{dt}x_{t_{B_2}}}}$$
  • $$\lim_{x\to {x_2}}{g'(x)}=\lim_{x\to {x_2}}{\frac{\frac{d}{dt}y_{t_{B_2}}}{\frac{d}{dt}x_{t_{B_2}}}}$$