# Move parabola to make it tangent to lines

could anyone help me with something very easy (I hope). I have two lines. For example:

$$y = \frac { x + 4.5 } { 6 }$$

(which is green line on the graph)

and

$$y = 1.2 x$$

(which is red line on the graph)

And I also have parabola like that:

$$y = x - 5 ( 0.5 x - 0.65 ) ^ { 2 }$$

I need to find coordinates to move parabola to make it tangent to both lines and with shape of parabola untouched, and lines can't be moved.

Are there any general rules to make such things. In the google I always find how to draw lines tangent to parabola and go through the point. But I can't figure it out how to make it in other direction

Graph now looks like that: You can move the parabola left-right by adding an offset to $$x$$ and you can move it up-down adding an offset to $$y$$. Let's solve the problem in the more general case. The original parabola is $$y=ax^2+bx+c$$. The new equation for the parabola will be $$y=a(x-x_0)^2+b(x-x_0)+c+y_0$$ We will need the derivative with respect to $$x$$ for the tangents, so $$y'=2a(x-x_0)+b$$ Now the equations of the lines are $$y=m_1x+n_1\\y=m_2x+n_2$$ When the parabola is tangent to a line, it means that they intersect at one point, and that the slopes at that points are identical. So say we have the tangent point with line 1 at $$x_1$$ and with line 2 at $$x_2$$, so you get the following system of equations: \begin{align}a(x_1-x_0)^2+b(x_1-x_0)+c+y_0&=m_1x_1+n_1\\ a(x_2-x_0)^2+b(x_2-x_0)+c+y_0&=m_2x_2+n_2\\ 2a(x_1-x_0)+b&=m_1\\2a(x_2-x_0)+b&=m_2 \end{align}

You have a system with four equations, with four unknowns $$(x_0,y_0,x_1,x_2)$$.

• Great thanks. I also have other question, about rotateing parabola round some point, but keeping tangent to two lines. But I think I should create separate subject. But one more, great thanks for your help – pajczur Nov 22 '18 at 8:03
• Hey, sorry but there is something wrong: you told on the end there are equations with four unknowns (x0,y0,x1,y1), but in equations I can't find y1, and among unknowns I can't find x2 which are in equations. So which part is wrong? – pajczur Nov 22 '18 at 8:50
• $(x_0,y_0,x_1,x_2)$ is the correct way. You can then find $y_1=m_1x_1+n_1$ and similarly for $y_2$. I've modified my answer. – Andrei Nov 22 '18 at 12:04

You can shift the graph of any function horizontally by a distance of $$\Delta x$$ by replacing $$x$$ with $$(x-\Delta x)$$, and vertically by simply adding $$\Delta y$$ to its value. If the curve is given implicitly by $$F(x,y)$$, the latter corresponds to replacing $$y$$ by $$(y-\Delta y)$$. In the same vein as Andrei’s answer, then, the problem is to find these offsets for your parabola. In contrast to that answer, we’ll work with the original parabola.

First, construct tangents to the parabola that are parallel to the two given lines. If the parabola is given by an equation of the form $$y=f(x)$$ (i.e., it’s the graph of $$f$$), an easy way to do this is to find the points at which the derivative of $$f$$ is equal to the two slopes. This is a matter of solving two very simple equations for $$x$$ and plugging those values into $$f$$. Now, find the intersection point $$P$$ of the two lines you’ve constructed, and the intersection $$Q$$ of the original two lines. The offset that you need is then simply $$(\Delta x,\Delta y) = Q-P$$. If you work in homogeneous coordinates, these computations can be done directly, without having to solve any other equations.

For your problem, we have $$f(x) = x-5(0.5x-0.65)^2$$, so $$f'(x) = 1-5(0.5x-0.65)$$. The slope of the first line is $$1/6$$, for which $$x=49/30$$ (assuming that those decimal fractions in $$f$$ are exact) and $$y=f(49/30)=269/180$$. For the second line the slope is $$1.2$$, giving $$x=61/50$$ and $$y=303/250$$. I assume that you know how to construct equations of the tangents through these points and finish the computation, but I’ll go through it with homogeneous coordinates to illustrate that method.

The line through two points is given by their cross product, as is the intersection of two lines. Also, if a line has slope $$m$$, then the point at infinity $$(1,m,0)$$ lies on that line. So, our two constructed tangent lines are $$(49/30,269,180,1)\times(1,1/6,0)=(-1/6,1,-11/9),$$ i.e., $$y=x/6+11/9$$, and $$(61/50,303/250,1)\times(1,12/10,0)=(-6/5,1,63/250).$$ Their intersection is therefore $$\left(-\frac16,1,-\frac{11}9\right)\times\left(-\frac65,1,\frac{63}{250}\right) \approx (1.474,1.509,1.033),$$ which we dehomogenize by dividing through by the last coordinate, yielding $$P\approx(1.427,1.460)$$. Intersecting the target lines, we have $$\left(\frac16,-1,\frac{45}{60}\right)\times\left(\frac{12}{10},-1,0\right) \approx (0.750,0.900,1.033),$$ or $$Q\approx (0.726,0.871)$$, from which $$\Delta x \approx -0.70$$, $$\Delta y\approx -0.59$$. The shifted parabola is therefore (to two decimal places) $$y = f(x+0.70)-0.59 = (x+0.70)-5(0.5(x+0.70)-0.65)^2-0.59.$$

• Hello great thanks for answer. But I have impression like now after your help I know little bit less. Is it really f’(x)=1 - 5(0.5x + 0.65). I was sure it should be f’(x)=1 - 2*5(0.5x + 0.65). But now I am not sure because your solution also works. So I am in great big black hole :) What’s wrong? – pajczur Nov 24 '18 at 3:11
• @pajczur You forgot to multiply by $0.5$ for the derivative of the parenthesized expression. You might want to review the chain rule. – amd Nov 24 '18 at 3:12
• Yes chain rule would be great. What should I multiply by $0.5$ ? Exactly which part? – pajczur Nov 24 '18 at 3:17
• Ok sorry my fault, I’ve found it thanks – pajczur Nov 24 '18 at 4:02