# How do you graph a sine or cosine function?

## Sinusoids FTW

All variations of functions that you would be asked to graph are translated or stretched / compressed mutations of the graphs of $y=\sin(x)$ and $y=\cos(x)$. These wave-like shapes are known as a sinusoids. It will also be important to realize that the graphs of $\sin(x)$ and $\cos(x)$ are identical to one another except that one is shifted over from the other:By adding coefficients to the function, these things quickly begin to look terribly messy. However, no matter how grim the outlook, you can graph a sin or cos function using a step-by-step that works every time and ensures you catch every detail every time.To be clear, we are going to graph functions of the form$$y=A\sin\left(b\left(x-h\right)\right)+k$$or$$y=A\cos\left(b\left(x-h\right)\right)+k$$Each of the four constants transforms the graph in its own way:$A$ - Amplitude - this dictates the height of the wave (vertical stretch)$b$ - Frequency - this determines the wavelength (horizontal stretch)$h$ - Phase Shift - this dictates horizontal shifts$k$ - Vertical Shift - this specifies whether the wave is moved up or downTo see how we account for these in turn, let's learn by doing and graph the following wave:$$y=3 \sin\left(\frac{\pi}{4} \big( x - 2 \big)\right) + 5$$

Before you start graphing the function, it helps to have a place to put your function. Additionally, the way you mark (or dont mark) your axes before drawing the function curve is greatly helpful for getting it done quickly and correctly.First, as per usual, get yourself a pair of $x$ and $y$ axis, complete with labels and arrows. Mark the origin but do not mark anything for unit length on either the $x$ and $y$ axis.

## Step 1 - Center Line and Vertical Boundaries

On a "natural" sine or cosine wave, the center line is the $x$-axis, and the wave attains a maximum height of $1$ and a minimum height of $-1$. These are the first two things we want to adjust for if needed in our general case.Start with the vertical shift, which comes from the $+k$ number. In our example, this is $+5$, so we will draw a dashed line lightly on our graph to show the line around which the wave will symmetrically oscillate.Next, we can also lightly sketch in min and max lines. The amplitude is the measure of how far up or down the wave will reach from the center line. In this example the amplitude is $3$, so the wave will oscillate between $2$ and $8$.Note that it will be helpful for the next steps if we do not make any marks on the $x$ axis yet, but now that we've got some vertical measurements written down we should label those heights.

## Step 2 - Determine Start Point

Before we start drawing curves, it makes sense to know where we are starting. In the vertical sense, that's what we accomplished in Step 1. Now we'll consider the horizontal shifts, if any exist in the sinusoid that we are drawing.The Phase Shift will determine the horizontal shift. A "normal" sine or cosine graph starts at $x=0$. If the $h$ value of your sinusoid is not zero when you look at the standard form $y=A\cos\left(b\left(x-h\right)\right)+k$, then you must start at the $x=h$ location instead of $x=0$.Note (very importantly) that, like horizontal shifts we learn about generically for functions, that whatever number is subtracted dictates the direction of the shift. In our example, we have$$y=A\cos\left(b\left(x-h\right)\right)+k$$$$y=3 \sin\left(\frac{\pi}{4} \big( x - 2 \big)\right) + 5$$such that $h=2$. We are therefore shifting to the right by $2$ (or, stated differently, shifting so that we move from the original starting line of $x=0$ to the new one $x=h=2$).This is also a good time to determine whether you are starting up, down, or center. Draw a dot as appropriate. Remember that positive cosine graphs start at the top peak, negative cosine graphs start at the bottom peak, and sine graphs start in the center regardless of sign.Our function is a positive sine graph, so we will start in the center.

## Step 3 - Determine Wavelength

Now that we've pinpointed exactly where to start drawing, let's figure out where to finish. The frequency number $b$ in your equation will determine this. The wavelength is$$L = \frac{360^\circ}{b}$$if you are measuring angles in degrees, and$$L = \frac{2\pi}{b}$$if you are measuring in radians. You will know which based on your instructions, more likely than not, and radians are by far the more common ask. If your frequency number is a fraction of $\pi$ then you are definitely working in radians.In our example, we have a frequency number of $\pi/4$, and so$$L = \frac{2\pi}{\frac{\pi}{4}} = 8$$Our wavelength is $8$.

## Step 4 - Draw

We can finally get the deed done! To aide in your artistry, I recommend making little tick marks halfway between the start and the end, and then halfway tick marks between halves, so that you have four sections.Then, keeping in mind the shape that your graphs should have (sine versus cosine, positive versus negative), draw in some dots for each quarter wave, up down or center. Connect the dots with smooth curves through your dots.Artistry skills shouldn't really hurt you, but if your teacher is picky, just do some practice! Smooth curves take practice - focus on getting a horizontal tangency at the tops and bottoms of the waves. If it looks too much like thisthey might get sad when they grade your paper.
• Popular Content
• Get Taught
• Other Stuff