# How do I represent this sine function?

1. Mar 15, 2015

I was struggling to represent the following for integer values of n:

$$\sin \left( \dfrac {n\pi } {2}\right)$$

I know for even n, we get zero

But for odd n, it alternates beween 1 and -1 for every other odd. Is there a compact way to represent that? I feel like I'm being dumb and missing something obvious.

Thanks!

2. Mar 15, 2015

### piggupiggu

1 when n = 1 + 2x
-1 when n = 3 + 2x

where x is zero or a positive even integer

3. Mar 15, 2015

### Mentallic

What you have is a piecewise function (the variable being n in this case).

$$k\in \mathbb{Z} \\ f(n) = \sin{\frac{\pi n}{2}} = \left\{ \begin{array}{lr} 0 & : n=2k\\ 1 & : n=4k+1\\ -1 & : n=4k+3 \end{array} \right.$$

4. Mar 15, 2015

### LCKurtz

I guess you are looking for something similar to $\cos(n\pi) = (-1)^n$ for $\sin(\frac{n\pi} 2)$. You may be able to find such an expression, but I don't think you will find anything "simpler" than $\sin(\frac{n\pi} 2)$ itself, unless you consider piecewise defined functions simpler. I don't.

5. Mar 17, 2015

Thank you so much for the responses everyone!

6. Mar 18, 2015

### Mentallic

I gave it a little more thought and came up with
$$\sin\left(\frac{n\pi}{2}\right)=\frac{1}{2}\left(-1\right)^{\frac{n-1}{2}}\left(1-(-1)^n\right)$$

7. Mar 19, 2015

### jbunniii

$$\sin\left(\frac{n\pi}{2}\right) = \frac{1}{2i}\left(i^n - (-i)^n\right) = \frac{1}{2}\left(i^{n-1} + (-i)^{n-1}\right)$$

: I guess that's equivalent to Mentallic's answer. Here's how I obtained it:

\begin{aligned} \sin\left(\frac{n\pi}{2}\right) &= \text{Im}\left(e^{in\pi/2}\right) \\ &= \frac{1}{2i} \left(e^{in\pi/2} - \overline{e^{in\pi/2}}\right) \\ &= \frac{1}{2i} \left(i^n - \overline{i^n}\right) \\ &= \frac{1}{2i} \left(i^n - (-i)^n\right) \\ \end{aligned}

Last edited: Mar 19, 2015
8. Mar 20, 2015

### LCKurtz

Yup. As I thought. Nothing "simpler" than $\sin\frac{n\pi} 2$ itself.