5

i know that the values of $\cos n\pi=(-1)^{n}$ and $\sin n\pi=0$. Now i want to know that what is the general expressions of $\cos \frac{n\pi}{2}$ and $\sin \frac{n\pi}{2}$.

Asaf Karagila
  • 393,674
Vishal
  • 215
  • 1
    When $n$ is even you already have the answer. When $n$ is odd try working a few out, the pattern is very easy to see. – fretty Jul 23 '12 at 09:41

3 Answers3

12

Using identities $\sin(x)^2 = \frac{1-\cos(2x)}{2}$ and $\cos(x)^2 = \frac{1+\cos(2x)}{2}$ we get

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

Thus :

  • $\sin\left(\frac{n\pi}{2}\right) = 0$ if $n$ is even and $\pm 1$ if odd
  • $\cos\left(\frac{n\pi}{2}\right) = 0$ if $n$ is odd and $\pm 1$ if even

To conclude we have to solve $\pm 1$ cases.

  • $\cos$ case : $n$ is even, $n=2p$. Then $$\cos\left(\frac{n\pi}{2}\right) = \cos\left(p\pi\right) = (-1)^p$$ So the result is $1$ if $p$ is even, $-1$ if odd
  • $\sin$ case : $n$ is odd, $n=2p+1$. Then $$\sin\left(\frac{n\pi}{2}\right) =\sin\left(p\pi+\frac{\pi}{2}\right) = \cos\left(p\pi\right) = (-1)^p$$ So $1$ if $p$ is even, $-1$ if odd

Finally we get the following general expressions :

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

vanna
  • 1,514
  • 8
  • 21
  • 1
    I think that for $n=3$ you have that $\sin(\frac{n\pi}2)\neq 1$. – Asaf Karagila Jul 23 '12 at 09:46
  • I agree that the final expressions are correct, but I would like to add that the floor functions are unnecessary. For the cosine, the floor can be omitted, and for the sine, floor($n/2$) can be replaced with $(n-1)/2$, and the expressions still hold. – Matt Majic Jul 07 '21 at 10:33
4

There are two cases:

  1. $n$ is even, write it as $2k$ and then you have $\cos(k\pi)$ and $\sin(k\pi)$ which you already know.
  2. $n$ is odd, write it as $2k+1$ and then you have $\cos(k\pi+\frac\pi2)$ and $\sin(k\pi+\frac\pi2)$. Recall that $\sin(x)=\cos(x+\frac\pi2)$, and deduce from the previous case what the values are.
Asaf Karagila
  • 393,674
  • @AsafFaragila sir i want to know the general expression. – Vishal Jul 23 '12 at 10:02
  • As sir i found that general expression for $\sin \frac{n\pi}{2}=(-1)^{[\frac{n}{2}]}$. i want to know for $\cos (\frac{n\pi}{2})$. – Vishal Jul 23 '12 at 10:06
  • @Vishal: No, this expression is wrong. For $n=2$ it is false. If you do find a general expression for $\sin(\frac{n\pi}2)$ then $\cos(\frac{n\pi}2)=\sin(\frac{(n+1)\pi}2)$, as the second sentence I wrote says. – Asaf Karagila Jul 23 '12 at 10:43
  • @Vishal : I added general expression for $\sin$ and $\cos$ in my answer. – vanna Jul 23 '12 at 12:16
1

$\displaystyle \cos\frac{n\pi}{2}=\{1,0,-1,0\}=2\left\lfloor\frac{n}{4}\right\rfloor+2\left\lfloor\frac{n+1}{4}\right\rfloor+1-n$

$\displaystyle \sin\frac{n\pi}{2}=\{0,1,0,-1\}=n-2\left\lfloor\frac{n+1}{4}\right\rfloor-2\left\lfloor\frac{n+2}{4}\right\rfloor$

hxthanh
  • 1,522