# Homework Help: The period, angular frequency of a piecewise function

1. Jan 14, 2017

### TheSodesa

1. The problem statement, all variables and given/known data
The function $f$ is defined as follows:
\begin{equation*}
f(t) =
\begin{cases}
1, \text{ when } 2k < t < (2k+1),\\
0, \text{ when } t = k,\\
2, \text{ when } (2k-1) < t < 2k, & k \in \mathbb{Z}\\
\end{cases}
\end{equation*}

What is the period $T$ of the function $f$? How about angular frequency? Calculate the following definite integrals:
$$a_n = \frac{2}{T}\int_{0}^{T} f(t) \cos (n \omega t) dt \text{ and } b_n = \frac{2}{T}\int_{0}^{T} f(t) \sin (n \omega t) dt,$$
where $n = 0,1,2, \ldots$
2. Relevant equations
Angular freguency:

\omega = 2 \pi f = \frac{2 \pi}{T}

3. The attempt at a solution
I should preface this by saying, that something in me thinks this should be a simple problem, and that I'm just confused by the notation used.

Anyways, I started by cataloging how the function should behave with different values of $k \in \mathbb{Z}$:
\begin{array}{ | l | c | c | c | c | c | c |}
\hline
k & 2k-1 & 2k & 2k+1 & f(t), (2k-1) < t < 2k & f(t), t = k & f(t), 2k < t < (2k+1)\\
\hline
0 & -1 & 0 & 1 & 2 & 0 & 1\\
1 & 1 & 2 & 3 & 2 & 0 & 1\\
2 & 3 & 4 & 5 & 2 & 0 & 1\\
3 & 5 & 6 & 7 & 2 & 0 & 1\\
4 & 7 & 8 & 9 & 2 & 0 & 1\\
\hline
\end{array}
It looks like $f$ will repeat in intervals of $2$, since whenever $k$ is increased by $1$, the domain of $f$ is shifted by $2$ to the right, and within that new domain $f$ is defined identically. Now here's the first thing that confuses me: I know I can test for periodicity by plugging $t+T$ in place of $t$ in $f(t)$. However, here it wouldn't create a nice expression that simplified into the original through trig symmetry or some other trick. How can I show in writing, that what I stated above is true, or is the above intuitive realization enough for a proof?

Moving on, assuming the period was 2 implies that $\omega = \frac{2 \pi}{2} = \pi$. Which leads us into the integration part of the problem, where another confusing thing occurs. Evaluating the integral seems simple enough: just split it into two parts between $0$ and $T = 2$ based on how $f$ is defined. However, in the assignment it is stated that $n \in {0} \cup \mathbb{N}$. Does this mean I need to evaluate the integral infinitely many times, since the expression contains an $n$ that gains all of those values? Of course not, but I have no idea what this means in practise.

2. Jan 14, 2017

### PeroK

The first task is to draw the graph of $f$. Can you describe in 1-2 simple sentences what $f$ looks like?

PS I don't like the definition as it's too loose. Personally, I would define it differently.

3. Jan 14, 2017

### TheSodesa

I did this in GeoGebra, and it looks like a step function that has a period of 2, except that the function is zero when $t \in \mathbb{Z}$ and varies between 2 and 1 between the integers.

Maybe I should do a Matlab implementation of the picture because of GG limitations...

4. Jan 14, 2017

### PeroK

Could I sketch the function based on your description? If I hadn't seen the formula? It's a good idea to be precise in mathematics.

By the way, setting $f(t) =0$ on a finite (or countable) set of points will make no difference to any integrals.

5. Jan 14, 2017

### TheSodesa

Alright, let's try again. Let $k \in \mathbb{Z}$. Between -1 and 0, $f(t) = 2$ and between 0 and 1 $f(t) = 1$. The function repeats this pattern ad infinitum with what seems to be a period of 2, shifting between the values 2 and 1 while being zero when $t = k$.

Is this any better?

6. Jan 14, 2017

### PeroK

Okay, so you've got $f(t)$ figured out. What about $\cos(n\omega t)$?

7. Jan 14, 2017

### TheSodesa

Since we have now established, that our period seems to be 2, our angular frequency $\omega = \pi \Rightarrow \cos (n \omega t) = \cos (n \pi t)$. Here $n \pi$ increases the frequency by multiples of $\pi$, while dividing the period by the same factor. Cosine of $t$ has a period of $2 \pi$, so $\cos (n \pi t) = \cos (n \pi t + \frac{2\pi}{n\pi}) = \cos (n \pi t + \frac{2}{n})$.

In other words, unless $n = 0$, in which case $cos(n\pi t) = 1$, $\cos (n \pi t)$ is just the usual cosine function with it's frequency increased, meaning it is squished in the $t$-direction.

8. Jan 14, 2017

### PeroK

I'm not sure I see the point of this question. If $T=2$ you just have to integrate over $(0,1)$ and $(1,2)$ on which $f(t)$ is constant.

9. Jan 14, 2017

### TheSodesa

I should have prefaced this by saying, that this is the first week of a course of Fourier methods, and the teacher gave us review excercises for homework, before we get into the proper subject matter. I wouldn't say this question is pointless since it is giving me a headache.

Are you saying, that the $n$ is there just to throw me off? Surely the integral evaluates differently depending on the value of $n$ in that interval?

10. Jan 14, 2017

### PeroK

Yes, you can go ahead and evaluate them. See what you get.

11. Jan 14, 2017

### TheSodesa

Alright, it took me a moment, but the results I got are as follows:

$$a_n = \frac{2 \sin (2 \pi n) - \sin (n \pi)}{n \pi}, n \neq 0$$
and
$$b_n = \frac{1 + \cos(n \pi) - 2 \cos (2 n \pi)}{n \pi}, n \neq 0.$$
So even though it was originally stated, that $n \in {0,1,2,...}$, $n$ can't be zero. Otherwise this was pretty straightforward.

EDIT: A mistake in $b_n$: Forgot to include the factor 2 in front of $\cos (2 \pi n)$.

Last edited: Jan 14, 2017
12. Jan 14, 2017

### PeroK

You can't stop there! You'll have to simplify those expressions.

13. Jan 14, 2017

### TheSodesa

Using trig identities doesn't seem to allow us to get rid of that annoying $n \pi$ in the denominator, which is why I assume we should be trying to simplify these even further. I'm a bit lost here.

14. Jan 14, 2017

### PeroK

Let me help you a little bit: $\sin(n\pi) = 0$.

15. Jan 14, 2017

### TheSodesa

Of course.
So $a_n = 0$.

As for $b_n$, $$\cos(2 \pi n) = 1 \Rightarrow \frac{1 + \cos(n \pi) - 2\cos(2 \pi n)}{n \pi} = \frac{1+\cos(n \pi) - 2}{n \pi} = \frac{\cos(n \pi) - 1}{n \pi}$$

16. Jan 14, 2017

### PeroK

Just a bit more to do ...

PS I take back what I said about this problem: it's a good work-out for the Fourier Analysis to come!

17. Jan 14, 2017

### TheSodesa

As far as I can see, the only thing we can do at this point is to say, that if $n$ is even, $b_n = 0$ , and if $n$ is odd, $b_n = \frac{-2}{n\pi}, n \neq 0$.

18. Jan 14, 2017

### PeroK

Yes. This sort of thing with $1 \pm \cos(n\pi)$ crops up frequently, so it's worth remembering this.

19. Jan 14, 2017

### TheSodesa

Alright, thank you very much.

One last thing that is still bothring me is the fact that there were $n$'s in the denominators of the expressions that reduced to zero as well. Do we not need to worry about those, or should I have included $n \neq 0$ with those as well?

20. Jan 14, 2017

### PeroK

Technically, you still have $n=0$ to do. These are special cases, as $\sin$ and $\cos$ are constant. One thing to remember is that you cannot differentiate or integrate these and then plug in $n=0$ later. You must treat them as constant functions from the outset. It's the same with trig identities. You can easily go wrong if you don't exclude $n=0$ before you use an identity.