# Visual Tangent Without Math Libraries

## Plain English first
Tangent answers the question: **how steep is this angle?**
If you stand at the origin and look at angle θ, tangent tells you the slope of your line of sight — how many units up for every unit across.
Steep upward angle → big positive tangent.
Pointing almost flat → tangent near zero.
Pointing straight up → tangent is undefined (no "across" component at all).
## The picture
On the unit circle, every angle gives you a point with coordinates `(cos θ, sin θ)`.
Tangent is the ratio of those two coordinates:
```text
tan(θ) = sin(θ) / cos(θ)
= vertical position / horizontal position
= rise / run
```
## Standard math notation
```text
tan θ = sin θ / cos θ = y / x
```
Equivalently in a right triangle with angle θ:
```text
tan θ = opposite / adjacent
```
## Verbose Python with descriptive names
```python
def compute_tangent_from_unit_circle(angle_in_radians):
"""
Compute tangent without a math library.
Tangent is the slope of the line from the origin to the point
on the unit circle at the given angle.
"""
# On the unit circle, the horizontal position is cosine
horizontal_position = cosine_approximation(angle_in_radians)
# On the unit circle, the vertical position is sine
vertical_position = sine_approximation(angle_in_radians)
# Tangent is slope: how far up for every unit across
# Guard against division by zero (happens at 90° and 270°)
if abs(horizontal_position) < 1e-10:
return None # tangent is undefined at this angle
slope = vertical_position / horizontal_position
return slope
def tangent_is_undefined_at(angle_in_degrees):
"""Return True if tangent is undefined at this angle."""
# Tangent blows up wherever cosine is zero: 90°, 270°, and every 180° from there
return angle_in_degrees % 180 == 90
```
## Where tangent blows up
As the angle approaches 90°, the horizontal position approaches zero and the slope shoots toward ±infinity.
| Angle | tan value |
|-------|-----------|
| 0° | 0 |
| 30° | 0.577 |
| 45° | 1.0 |
| 60° | 1.732 |
| 89° | 57.29 |
| 90° | undefined |
| 91° | -57.29 |
| 135° | -1.0 |
| 180° | 0 |
## Common mistakes
- Calling `tan(90°)` in code and getting `Inf` or an exception — always guard with a check.
- Confusing tangent (slope) with tangent lines in geometry. Same word, related concept, but different context.
- Assuming tangent repeats every 360° like sine and cosine. It actually repeats every **180°**.
## See also
- [Visual Unit Circle Sine and Cosine Without Math Libraries](/articles/ad8e2329-c2a5-4f28-a4fb-251496ff9069)
- [Visual Inverse Trig and atan2 Without Math Libraries](/articles/85a06148-c2a9-429d-93e4-3b8ffcb93089)
- [Visual Geometry and Trigonometry — Table of Contents](/articles/6e6fe0ba-ee87-48bd-9734-6fc7196323ac)