Touching sine waves I'm currently investigating the following system of equations
$$
t(x)=\sin(x)+c\\
s(x)=q(a;c)\cdot \sin(x+a)
$$
Where the goal is to have them 'Touch' as shown here https://www.desmos.com/calculator/fnekyssei2
Touch is defined as $\exists x. ( t(x) = s(x) )\ \wedge\ ( t'(x) = s'(x) )$
This means that this system reduces to ( for some $x$ which is the touching point )
$$
\sin(x) + c = q(a;c)\cdot \sin(x+a)\\
\cos(x) = q(a;c)\cdot \cos(x+a)
$$
Now I want to solve this for $q(a;c)$, but I'm unsure how to continue.
For $c=1$ it seems like the solutation for $q(a;1)$ is $2 \cdot \cos(a)$
 A: so you are looking for $(q,x_0)$ that satisfy :
$$
\left\{
 \begin{array}{l}
  \sin(x_0)+c = q \sin(x_0+a)  \\
  \cos(x_0) = q \cos(x_0+a)
 \end{array}
\right. \tag{1}
$$
with given $a$ and $c$. you can make this to something like a 2 by 2 linear system for $\sin(x_0)$ and $\cos(x_0)$.
$$
\left\{
 \begin{array}{l}
  (q\cos(a)-1) \sin(x_0)+ (q \sin(a)) \cos(x_0) = c  \\
  (-q \sin(a)) \sin(x_0) +(q\cos(a)-1) \cos(x_0) = 0
 \end{array}
\right.
$$
so it becomes:
$$
\rightarrow
 \left(\begin{array}{rr}
    q\cos(a)-1 & q \sin(a)   \\
    -q \sin(a) & q\cos(a)-1
  \end{array}\right)
 \left(\begin{array}{r}
    \sin(x_0)   \\
    \cos(x_0)
  \end{array}\right) =
 \left(\begin{array}{r}
    c   \\
    0
  \end{array}\right)
\tag{2}
$$
to solve this we should calculate the determinant of coefficients matrix $d := det = q^2 -2q\cos(a)+1$. then $(2)$ becomes:
$$
\left\{
 \begin{array}{l}
  \sin(x_0) = \frac{qc\cos(a)-c}{d}  \\
  \cos(x_0) = \frac{-qc \sin(a)}{d}
 \end{array}
\right. \tag{3}
$$
next in order for $(3)$ to have solution we should have : $\sin^2(x_0) + \cos^2(x_0)=1$. this gives us:
$$
\frac{q^2c^2-2qc^2\cos(a)-c^2}{(q^2-2q\cos(a)+1)^2} = \frac{c^2 d}{d^2}=1
$$
because from $(2)$ $d\neq 0$, we find that $\underline{d=c^2}$. solving this for $q$ gives :
$$
q = \cos(a) \pm \sqrt{\cos^2(a)-1+c^2} \tag{4}
$$
and $x_0$ can be found with eather of $(3)$.
in order to have a real-valued answer for $q$ and $x_0$ there are some conditions we should consider:
$$
\left\{
\begin{array}{l}
        \text{from  } (2) \rightarrow d \neq 0  \\
  \text{from  } (4) \rightarrow c^2>1-\cos^2(a)  \\
  \text{from  } (3) \rightarrow -1 \leq q \cos(a)-1 \leq1 \\
  \text{from  } (3) \rightarrow -1 \leq q \sin(a) \leq1
 \end{array}
\right.
$$
see this https://www.desmos.com/calculator/h4dhomrln0. in this link consider that changes in $a$ and $c$ may fail the touching because the above conditions may not satisfied.
