This page explains the sketching and graphing of the tangent and cotangent functions of the form \[ y = a \tan \big[ k ( x - d) \big] \quad \text{and} \quad y = a \cot \big[ k ( x - d) \big] \] with detailed examples to help students understand their behavior and graph transformations.
The range of both tangent and cotangent functions is \((- \infty , +\infty)\). The period for each is \(\pi\). The horizontal shift or translation is given by \(d\), where the graph shifts left if \((- d)\) is positive, and right if \((- d)\) is negative.
Vertical asymptotes occur at
\[ x = \dfrac{\pi}{2} + k\pi, \quad k = 0, \pm 1, \pm 2, \ldots \]
for \(y = \tan(x)\), and at
\[ x = k\pi, \quad k = 0, \pm 1, \pm 2, \ldots \]
for \(y = \cot(x)\).
To understand key properties of these functions, recall the identities:
\[ y = \tan(x) = \dfrac{\sin(x)}{\cos(x)} \quad \text{and} \quad y = \cot(x) = \dfrac{\cos(x)}{\sin(x)}. \]
All zeros of \(\sin(x)\) correspond to zeros of \(\tan(x)\). All zeros of \(\cos(x)\), which appear in the denominator, correspond to vertical asymptotes of \(\tan(x)\), as illustrated below.

All zeros of \(\cos(x)\) correspond to zeros of \(\cot(x)\). All zeros of \(\sin(x)\), which are in the denominator, correspond to vertical asymptotes of \(\cot(x)\), as shown below.

Sketch the graph of \[ y = \tan\left( 2x + \dfrac{\pi}{2} \right) \] over one period.
Range: \((- \infty , +\infty)\).
Period: \(\dfrac{\pi}{|k|} = \dfrac{\pi}{2}\).
Vertical asymptotes occur where \[ 2x + \dfrac{\pi}{2} = \dfrac{\pi}{2} + k\pi \] which simplifies to \[ x = \dfrac{k\pi}{2}, \quad k = 0, \pm 1, \pm 2, \ldots \]
The horizontal shift due to \(\dfrac{\pi}{2}\) allows rewriting the function as \[ y = \tan \big[ 2 ( x + \dfrac{\pi}{4} ) \big]. \]
This means the graph shifts \(\dfrac{\pi}{4}\) units to the left.
Two steps to graph the function \( y = \tan\left( 2x + \dfrac{\pi}{2} \right) \)
1) Sketch \(\tan(2x)\) over one period from \(0\) to \(\dfrac{\pi}{2}\) (blue graph below).
2) Then sketch \[ y = \tan \big[ 2 ( x + \dfrac{\pi}{4} ) \big] \] by translating the previous graph \(\dfrac{\pi}{4}\) to the left (red graph below), making the period start at \(- \dfrac{\pi}{4}\) and end at \(\dfrac{\pi}{4}\), which is one full period \(\dfrac{\pi}{2}\).

Sketch the graph of \[ y = \cot \left( 4x - \dfrac{\pi}{4} \right) \] over one period.
Range: \((- \infty , +\infty)\). Period: \(\dfrac{\pi}{|k|} = \dfrac{\pi}{4}\). Vertical asymptotes are found by solving \[ 4x - \dfrac{\pi}{4} = k \pi, \] which gives \[ x = \dfrac{k \pi + \dfrac{\pi}{4}}{4}, \quad k = 0, \pm 1, \pm 2, \ldots \] The horizontal shift due to \(- \dfrac{\pi}{4}\) can be rewritten as \[ y = \cot \left[ 4 \left( x - \dfrac{\pi}{16} \right) \right]. \] This represents a shift of \(\dfrac{\pi}{16}\) units to the right.
Two steps to graph the function \( y = \cot \left( 4x - \dfrac{\pi}{4} \right) \)
1) Start by sketching \(\cot(4x)\) over one period from \(0\) to \(\dfrac{\pi}{4}\) (blue graph).
2) Then sketch \[ y = \cot \left[ 4 \left( x - \dfrac{\pi}{16} \right) \right] \] by translating the graph \(\dfrac{\pi}{16}\) to the right (red graph below), making the period start at \(\dfrac{\pi}{16}\) and end at \(\dfrac{5\pi}{16}\), which is one full period.