# How do you graph  y = cos pi x?

Sep 2, 2016

#### Answer:

See explanation below

graph{cos(pi*x) [-5, 5, -2, 2]}

#### Explanation:

Graph of function $y = f \left(x\right)$, by definition, is a set of all points $\left(A , B\right)$ on the coordinate plane that satisfy the equation
$B = f \left(A\right)$.

Given a graph of a function $y = f \left(x\right)$, the graph of $y = f \left(K x\right)$, where $K \ne 0$, can be obtained by "squeezing" the original graph horizontally towards the Y-axis in $K$ times.

Here is why.
Consider a point $\left(A , B\right)$ belongs to original graph. It means that $B = f \left(A\right)$.
Consider now a point $\left(\frac{A}{K} , B\right)$. Obviously, it belongs to a graph of function $y = f \left(K x\right)$ since
$f \left(K \frac{A}{K}\right) = f \left(A\right) = B$

So, for each point $\left(A , B\right)$ that belongs to a graph of function $y = f \left(x\right)$, point $\left(\frac{A}{K} , B\right)$ belongs to a graph of function $y = f \left(K x\right)$.
The point $\left(\frac{A}{K} , B\right)$ can be obtained from the point $\left(A , B\right)$ by horizontal "squeezing" towards Y-axis.

Of course, if $K < 0$, the whole graph is symmetrically reflected relative to Y-axis. If $| K | < 1$, our "squeezing" is, actually, stretching.

To construct a graph of function $y = \cos \left(\pi x\right)$, we have to start from $y = \cos \left(x\right)$ and "squeeze" is horizontally towards Y-axis by a factor $\pi$.
That means, the shape is preserved, but the periodicity will be in $\pi$ times smaller, that is $\frac{2 \pi}{\pi} = 2$.