1. Trigonometric "regression".

Hello.
I have just encountered this problem. I want to find a cosine function with the graph represented on the picture below.

I have found the following:
$\rm{A} \times \cos(cx + \phi) + d$

$2 \times \cos(\frac \pi 2x + \phi)$
$d=0$

But I am unable to find $\phi$. So then my question would be: How do I find it, please?

In advance, thank you for spending time and efforts on my problems :]

2. Hi
Originally Posted by MatteNoob
Hello.
I have just encountered this problem. I want to find a cosine function with the graph represented on the picture below.

I have found the following:
$\rm{A} \times \cos(cx + \phi) + d$

$2 \times \cos(\frac \pi 2x + \phi)$
$d=0$

But I am unable to find $\phi$. So then my question would be: How do I find it, please?
I guess that $\phi\in (-\pi,\pi]$ ?

One possiblity to find the value of $\phi$ is noting that for $x_0=-\frac{2}{\pi}\phi$ one has $2\cos\left(\frac{\pi}{2}x_0+\phi\right)=2\cos\left (-\frac{\pi}{2}\frac{2}{\pi}\phi+\phi\right)=2$. As $\phi\in (-\pi,\pi]$ we also have $x_0\in[-2,2)$. Using the graph, one can solve $2\cos \left( \frac{\pi}{2}x_0+\phi\right)=2$ for $x_0\in[-2,2)$ and derive the value of $\phi$.

3. Originally Posted by flyingsquirrel
Hi

I guess that $\phi\in (-\pi,\pi]$ ?

One possiblity to find the value of $\phi$ is noting that for $x_0=-\frac{2}{\pi}\phi$ one has $2\cos\left(\frac{\pi}{2}x_0+\phi\right)=2\cos\left (-\frac{\pi}{2}\frac{2}{\pi}\phi+\phi\right)=2$. As $\phi\in (-\pi,\pi]$ we also have $x_0\in[-2,2)$. Using the graph, one can solve $2\cos \left( \frac{\pi}{2}x_0+\phi\right)=2$ for $x_0\in[-2,2)$ and derive the value of $\phi$.

The task doesn't say anything about $\phi \in \langle -\pi, \, \pi ]$ however, the correct answer should be that $\phi = \frac \pi 4$

I am not sure how you found $x_0 = -\frac 2\pi$, so please feel free to elaborate on that. :]

Furthermore, I didn't understand how you found that:
$2\cdot \cos\left(-\frac\pi 2 \cdot \frac 2\pi \phi + \phi\right) = 2$ (What I mean is, how do you know it is equal to two?)

4. Originally Posted by MatteNoob
I am not sure how you found $x_0 = -\frac 2\pi$, so please feel free to elaborate on that. :]
I don't know if you made a typo or misread but $x_0=-\frac{2}{\pi}{\color{red}\phi}$. I chose this value because the link between $x_0$ and $\phi$ is simple hence once you know $x_0$ you can easily find $\phi$. I've no other jusification, I just noted this.

Furthermore, I didn't understand how you found that:
$2\cdot \cos\left(-\frac\pi 2 \cdot \frac 2\pi \phi + \phi\right) = 2$ (What I mean is, how do you know it is equal to two?)
$2 \cos\left(-\frac\pi 2 \cdot \frac 2\pi \phi + \phi\right) =2 \cos\left(-\phi + \phi\right) =2 \cos 0= 2$

5. @ flyingsquirrel

Oh, yes, sorry about that typo, hehe. Thank you for the explanation, it is much more clear now. If you have other methods, please feel free to educate me on those too. :]

Again, thank you very much for your time and help, I appreciate it!

6. Originally Posted by MatteNoob
If you have other methods, please feel free to educate me on those too. :]
Another method would be using inverse trigonometric functions.

(we still work with $\phi\in(-\pi,\pi]$)

Using the graph, we know that $2\cos\left(\frac{\pi}{2}\cdot 0+\phi\right) \approx 1.39$ (y-intercept) hence $\cos \phi \approx \frac{1.39}{2}=0.70$. This gives us two values for $\phi$ : either $\phi\approx\arccos 0.70$ either $\phi\approx-\arccos 0.70$. To determine which of the two values is the right one, let's use another point. For example, we know that $0=2\cos\left( \frac{\pi}{2}\cdot 0.5+\phi \right)$ (x-intercept for $x=0.5$) hence $\phi$ has to satisfy the equation $0=\cos\left(\frac{\pi}{4}+\phi\right)$ which is only possible if $\phi\approx-\arccos 0.70=-46^{\circ}$.

7. @ flyingsquirrel

Thank you very much for the other method. :]

If you still have some time, I'd like to go back to the $x_0= \frac 2\pi \phi$ thing. I am sorry if I come across as thick, but as you have probably noted from my signature, I have some issues regarding terminology etc.

Originally Posted by flyingsqurirrel
I don't know if you made a typo or misread but . I chose this value because the link between and is simple hence once you know you can easily find . I've no other jusification, I just noted this.
The problem is that I don't understand how you found $x_0$ to be $-\frac 2\pi$

Is this because it would cancel out the period for the function and then set it to zero? Let me give you an example of what I mean.

If $f(x) = 5\cos\left(\frac \pi 4x + \phi \right)$
would: $x_0 = -\frac 4\pi \phi$ which gives us:
$5\cos\left(\frac{\pi}{4}\cdot -\frac{4}{\pi}\phi + \phi\right) = 5\cos(0) = \underline{5}$

So then, when we know that $x\in [-5,\, 5]$ and $\phi \in [-\pi,\, \pi\rangle$ ?

If so, how do you know that $\phi \in [-\pi, \, \pi \rangle$ ?

Sorry about the lengthy and messy post, but I can't help being curious and craving understanding here, hehe.

8. Originally Posted by MatteNoob
The problem is that I don't understand how you found $x_0$ to be $-\frac 2\pi$

Is this because it would cancel out the period for the function and then set it to zero?
Yes ! (I should have written this in one of my previous posts...)
Let me give you an example of what I mean.

If $f(x) = 5\cos\left(\frac \pi 4x + \phi \right)$
would: $x_0 = -\frac 4\pi \phi$ which gives us:
$5\cos\left(\frac{\pi}{4}\cdot -\frac{4}{\pi}\phi + \phi\right) = 5\cos(0) = \underline{5}$
OK

So then, when we know that $x\in [-5,\, 5]$ and $\phi \in [-\pi,\, \pi\rangle$ ?

If so, how do you know that $\phi \in [-\pi, \, \pi \rangle$ ?
I'm not sure to understand what you mean. Anyway : the cosine function is $2\pi$-periodic hence without the condition $\phi \in (-\pi, \, \pi ]$, $\phi$ could be any number $\frac{\pi}{2}+2k\pi,\,k\in\mathbb{Z}$. As we only want one value of $\phi$, we add the condition $\phi\in(-\pi, \, \pi ]$. This gives us a unique solution : $\frac{\pi}{2}$. Note that one can choose any interval as long as its "length" is $2\pi$ : we could have set $\phi\in[42,42+2\pi)$... (usually one takes $\phi$ in $(-\pi,\pi]$ or in $[0,2\pi)$)

Then, from the condition $\phi\in(-\pi,\pi]$ we can find the interval in which $x_0=-\frac{4}{\pi}\phi$ lies :

We know that $-\pi<\phi \leq \pi$

Multiply the inequalities by -1 : $\pi>-\phi\geq -\pi$

Multiplying by $\frac{4}{\pi}$ we get $\frac{4}{\pi}\cdot \pi > -\frac{4}{\pi}\phi \geq -\frac{4}{\pi}\cdot \pi$

Simplifying, it gives us : $4>x_0\geq 4$

In other words : $x_0\in[-4,4)$. (I should also have explained this in one of my previous posts )