Curve equidistant to sine and cosine.

272 Views Asked by At

If I have the sine and cosine curves plotted, what would be the formula of the curve that is equidistant to both curves? Here's a picture of how it looks like.

enter image description here

The original question comes from a reddit post, I have worked on it for a bit but don't even know where to start.

I have no idea about how to even find the closest point on the cosine graph given a point on the sine graph. I suspect the answer would not be very nice, a closed form may not even exist.

Edit: the Reddit post: https://www.reddit.com/r/math/comments/487lfw/a_problem_that_has_been_bothering_me_for_a_while/?sort=confidence

2

There are 2 best solutions below

2
On BEST ANSWER

Consider a point $(x_s,\sin(x_s))$ on the sin curve and a point $(x_c,\cos(x_c))$ on the cos curve. The normals to the curves at these points are:

$$y=\sin(x_c)+\cos(x_s)(x-x_s)$$ $$y=\cos(x_s)-\sin(x_c)(x-x_c)$$

Solving simultaneously gives the point of intersection $(x_i,y_i)$.

$$(x_i,y_i)=\left(\frac{\cos(x_c)-\sin(x_s)+x_s\sin(x_c)+x_c\cos(x_s)}{\sin(x_c)+cos(x_s)},\frac{\cos(x_c)\cos(x_s)+\sin(x_s)\sin(x_)+x_c\cos(x_s)\sin(x_c)-x_s\cos(x_s)\sin(x_c)}{\sin(x_s)+\cos(x_c)}\right)$$

Next we want to solve such that the distances are equal:

$$\left(\frac{\cos(x_c)-\sin(x_s)+(x_c-x_s)\sin(x_c)}{\sin(x_s)+\cos(x_c)}\right)^2+\left(\frac{\cos(x_s)(\cos(x_c)-\sin(x_s)+(x_c-x_s)\sin(x_c))}{\sin(x_s)+\cos(x_c)}\right)^2=\left(\frac{\cos(x_c)-\sin(x_s)+(x_s-x_c)\cos(x_s)}{\sin(x_s)+\cos(x_c)}\right)^2+\left(\frac{\sin(x_c)(\sin(x_s)-\cos(x_c)+(x_c-x_s)\cos(x_s))}{\sin(x_s)+\cos(x_c)}\right)^2$$

Removing denominator and factorizing gives:

$$(1+\cos(x_s)^2)(\cos(x_c)-\sin(x_s)+(x_c-x_s)\sin(x_c))^2=(1+\sin(x_c)^2)(\cos(x_c)-\sin(x_s)+(x_c-x_s)\cos(x_s))^2$$

This doesn't have a closed form for $x_s$ in terms of $x_c$ (or vice versa) so we can't express the distance in terms of just one of $x_s$ or $x_c$ let alone try to minimize it so I'm pretty confident there is no closed form for it.

2
On

Take a point $P=(a,b)\in [0,2\pi]\space\text{x}\space [-1,1]$; the squares of the distances of $P$ to the curves $y= \sin x$ and $y=\cos x$ are $$D_1(x)=(x-a)^2+(\sin x-b)^2\\D_2(x)= (x-a)^2+(\cos x-b)^2$$ The extremum of these two fonctions can be got taking derivatives so $$D_1’(x)=2x+\sin 2x-2b\cos x-2a\\D_2’(x)=2x-\sin 2x+2b\sin x-2a$$ The equations $$D_1’(x)=0\\D_2’(x)=0$$ are trascendental; furthermore, using slider control you can see that these equations can have both, just one real root or exactly three real roots. Among these roots of transcendental equations are the corresponding to the minimum of $\sqrt{D_i}; i=1,2$.

We can ensure that it is quite improbable a closed form for the searched function.