Center of a circle rolling on the graph of a sinusoidal function ( say $f(x)=3\cos(x/3) $) I'd like to draw a circle rolling on the graph of the function $f(x)=3(\cos \frac{x}{3})$.
I've set radius = 3 units.
My idea was as follows :
(1) define a point $P=(a, f(a)) $ ( with $a$ varying over some interval )
(2) defining a tangent function at $P$ and then a function corresponding to the perpendicular to this tangent at $P$
(3) defining , uning trigonometry, a point located on this perpendicular at 3 units from point $P$ , in order to use this point as the center of the desired circle
My question : how to use the tangent function in order the center of the circle not to lie below the curve when the point goes upward  ( as one can see on the image below )?
Here my attempt using Desmos : https://www.desmos.com/calculator/tpdfunm1kd


 A: $y = 3 \cos (\frac{x}{3})$
$y' = - \sin (\frac{x}{3})$
So the slope of normal line at point $(t, 3 \cos (\frac{t}{3})$ is $ \cfrac {1}{\sin (\frac{t}{3})}$.
If the normal line makes angle $\theta$ with $x$-axis,
$\cos \theta = \cfrac{\sin (\frac{t}{3})}{\sqrt{1 + \sin^2 (\frac{t}{3}})}$
$\sin \theta = \cfrac{1}{\sqrt{1 + \sin^2 (\frac{t}{3}})}$
The center of the circle will be on the normal line and if radius of the circle is $3$, its coordinates will be,
$(t + 3 \cos\theta, 3 \cos (\frac{t}{3}) + 3 \sin \theta)$
This will be a circle that will be above the curve at all points and equation of circle is,
$\left(x-t-\frac{3\sin(t/3)}{\sqrt{1+\sin^2 (t/3)}}\right)^2 + \left(y-3\cos(t/3)-\frac{3}{\sqrt{1+\sin^2(t/3)}}\right)^2 = 3^2$
Also note that if the radius of the circle is large, it will slide on the curve but another point on the circle may intersect the curve.
A: HINTS:
$$ y= 3 \cos (x/3), \text{differentiate,}\tan \phi= y'= -\sin (x/3)$$
$$\text{ Construct right triangle hypotenuse } h= \sqrt{1+ \sin^2 (x/3)}$$
$$ \sin \phi = \frac{\sin x/3}{h};\;\cos \phi = \frac{1}{h}; \text{ Plug into parametric: }  (x_C,y_C)=(x,y)+ 3 \;( \sin \phi, \cos \phi) $$
Reverse last sign if (a magnetized) circle is to roll underneath the sine curve without falling off while remaining in contact with sine profile during  rolling.
