liveBook · Manning

Tangent

As explained in Math for Web Design

Tangent is the trigonometric function equal to the length of the side opposite an angle divided by the length of the adjacent side.

Tangent, written tan(θ), measures an angle’s steepness. In a right triangle, it is the opposite side divided by the adjacent side: tan(θ) = opposite / adjacent. It can also be written as sin(θ) / cos(θ). On a coordinate plane, tangent gives the slope of the line from the origin to a point at angle θ. section 9.1.1 section 9.6

Read tangent values around a circle

At 0°, tan is 0; at 45°, it is 1; and at 135°, it is −1. At 90° and 270°, tangent is undefined because the angle is vertical, so there is no finite slope. This makes tangent useful for reasoning about direction and steepness, while sine and cosine provide circular x and y positions. section 9.1.1 section 9.5

Figure 9.3 The graph of tan(θ) for −2π ≤ θ ≤ 2π

Use the tangent graph to see its repeating values and the vertical gaps where tangent is undefined. section 9.1.1

CSS provides tan(angle), and JavaScript provides Math.tan(angle). Both return a tangent value from an angle or number. The CSS trig functions became broadly available in major evergreen browsers from March 2023; tan(90deg) is undefined, so vertical-angle cases need deliberate handling. section 9.1.5

For visual interfaces, tangent belongs to the same practical trig toolkit as sine and cosine: rotating or skewing elements, building curved animation, and making directional calculations. Use sine and cosine when you need a point’s circular position; use tangent when the important result is the line’s steepness. section 9.0 section 9.1.1

How Math for Web Design covers it

How deep it goes
Defines tangent through right-triangle ratios, coordinate-plane slope, representative unit-circle values, and undefined vertical cases.
Examples
Uses unit-circle values including 0°, 45°, 90°, 135°, and 270° to illustrate finite and undefined tangent.
What it assumes
Introduces tangent from right-triangle side ratios and defers radians and degree conversion to related treatment.
What you can do after
Apply it via CSS tan() or JavaScript Math.tan() to obtain an angle’s steepness value.
How it connects
Connects tangent to sine, cosine, right triangles, the unit circle, slope, radians, CSS, and JavaScript.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Math for Web Design. The section links point to the parts of the book it draws on.