How can I calculate a Polynomial that passes through the origin and a given point (P
) having given tangents at the origin (Ot
) and the given point (Op
)?
The given point will always be to the right of the origin (Px > 0
). The polynomial should be a function of x (i.e. it moves from left to right).
I believe a 3rd degree polynomial will always fit these constraints, but I'm not certain.
I am looking for a function f( x, Px, Py, Ot, Pt ) = ?
which plots a polynomial for x
, satisfying the four given values.
When x = 0, f() = 0
When x = Px, f() = Py
When x = 0, f'() = Ot
When x = Px, f'() = Pt
Best Answer
The slope of a tangent line is the derivative, so you want to solve a system of the form ($p\ne 0$)
$$f(0)=0, f(p)=q,$$ $$f'(0)=a, f'(p)=b.$$
The coefficients of $f$ are the unknowns, and we have four equations making a linear system for the coefficients. To ensure a solution, we need also four unknowns i.e. a degree $3$ polynomial. From the left two conditions we know that $f(x)=dx^3+cx^2+ax$. The right two conditions then are
$$\begin{pmatrix}p^3 & p^2\\3p^2 & 2p\end{pmatrix} \begin{pmatrix}d\\c\end{pmatrix}=\begin{pmatrix}q-ap\\b-a\end{pmatrix}.$$
Solving,
$$\begin{pmatrix}d\\c\end{pmatrix}=-\frac{1}{p^4}\begin{pmatrix}2p & -p^2\\-3p^2 & p^3\end{pmatrix}\begin{pmatrix}q-ap\\b-a\end{pmatrix}.$$
Thus we have
$$f(x,p,q,a,b)=-\frac{2p(q-ap)-p^2(b-a)}{p^4}x^3-\frac{-3p^2(q-ap)+p^3(b-a)}{p^4}x^2+ax.$$
EDIT: Also, the polynomial can be quadratic or linear if and only if the corresponding coefficients above vanish appropriately. To see this, solve the quadratic case to get the condition
$$\frac{q-ap}{p^2}=\frac{b-a}{2p},$$
which is equivalent to $d=0$. By geometry, the linear case occurs when $a=b=p/q$, which can also be shown as logically equivalent to $d=c=0$.