Chapter 1
15 min read
Section 4 of 353

Power Functions and Scaling Laws

Mathematical Functions - The Building Blocks

Learning Objectives

By the end of this section, you will be able to:

  1. Define a power function f(x)=kxnf(x) = k\,x^{n} and tell it apart from an exponential function f(x)=axf(x) = a^{x}.
  2. Recognize the qualitative shape of xnx^{n} for any real exponent — including negative and fractional — at a single glance.
  3. Use the log-log trick to turn any power law into a straight line and read off the exponent.
  4. Apply scaling laws to real phenomena: the square–cube law in biology, Kepler's third law, the inverse-square law of gravity and light, and Kleiber's law of metabolism.
  5. Preview the power rule ddxxn=nxn1\frac{d}{dx}\,x^{n} = n\,x^{n-1} and compute the slope of a power function at any point.
  6. Implement these ideas in Python: plot the family, and fit an unknown exponent from data.

The Big Picture: One Knob, A Whole Universe

"If you can change one number and watch the entire shape of the world change with it, you have found a power function."

A power function is a function with exactly one moving part: an exponent. Write it as f(x)=kxnf(x) = k\,x^{n}, and everything you care about — whether the curve grows or shrinks, how fast, what it does near zero, what it does at infinity, whether doubling the input doubles the output or makes it eight times bigger — is decided by the single number nn. The coefficient kk just stretches the picture vertically.

The mental model

Think of nn as a shape dial and kk as a volume knob. Sliding nn morphs the curve through every shape that nature seems to prefer: lines, parabolas, cubes, square roots, hyperbolas. Sliding kk only changes the loudness.

Why this one family keeps reappearing

When a system has no preferred scale — when zooming in by a factor of 10 just rescales the picture rather than revealing new structure — the laws that govern it are power laws. That is why the same algebra describes phenomena that look unrelated:

🌍 Physics

  • Gravity: F1/r2F \propto 1/r^{2}
  • Light intensity: I1/r2I \propto 1/r^{2}
  • Stefan–Boltzmann: PT4P \propto T^{4}
  • Kinetic energy: E=12mv2E = \tfrac{1}{2}mv^{2}

🐘 Biology

  • Kleiber: RM3/4R \propto M^{3/4}
  • Heart rate: HRM1/4\text{HR} \propto M^{-1/4}
  • Lifespan: LM1/4L \propto M^{1/4}
  • Bone strength: cross-sectionM2/3\text{cross-section} \propto M^{2/3}

🪐 Astronomy

  • Kepler 3rd: T2a3T^{2} \propto a^{3}
  • Black-body flux: FR2T4F \propto R^{2}T^{4}
  • Galaxy luminosity vs mass: LMαL \propto M^{\alpha}

🏙️ Cities, networks, data

  • Zipf's law for word frequency: f1/rankf \propto 1/\text{rank}
  • Pareto wealth distribution
  • Neural-network scaling laws: loss ∝ params^(−α)

Mathematical Definition

A power function is any function of the form

f(x)=kxnf(x) = k\,x^{n}

where kk is a real constant (the coefficient) and nn is a real constant (the exponent). The input xx is the only variable.

Power function vs exponential function — never confuse these

Both involve raising-to-a-power, but the variable lives in different places:

FunctionFormVariable isConstant is
Powerf(x) = k · x^nthe base xthe exponent n
Exponentialf(x) = a^xthe exponent xthe base a

The classic trap

x2x^{2} is a power function (variable base). 2x2^{x} is an exponential function (variable exponent). They look almost identical on paper. They behave nothing alike for large xx: 102=10010^{2} = 100, but 210=10242^{10} = 1024. Exponentials beat any power function eventually.


The Power Function Explorer

Before any algebra, build the intuition with your hand. Drag the nn slider through the whole range. Watch the curve morph continuously between every shape we'll catalogue below. Try the preset buttons. Drag x0x_{0} and notice how the orange tangent rotates — that's the derivative we'll meet at the end of the section.

Power Function Explorer — f(x) = k · xn

drag the sliders. drag x₀ to inspect the slope.
xy(1, 1)x₀ = 1.00
f(x₀) = 1.0000
f′(x₀) = 2.0000 (= k·n·x₀^(n−1))

Three things to notice

  • Every curve with k=1k = 1 passes through (1,1)(1, 1). Reason: 1n=11^{n} = 1 for any nn. This is the pivot of the family.
  • For n>0n > 0 the curve hugs the x-axis near zero. For n<0n < 0 it shoots straight up to infinity at zero — that's a vertical asymptote.
  • The tangent slope at x0=1x_{0} = 1 equals exactly knk \cdot n. You can read off the exponent by measuring slope at x=1x = 1.

A Tour Through the Family

Now let's name what you just saw on the explorer. With k=1k = 1 for simplicity, every value of the dial nn lands somewhere on this map:

Exponent nFunctionShapeBehavior near 0Behavior at ∞
n = 0f(x) = 1horizontal liney = 1y = 1
0 < n < 1 (e.g., 1/2)f(x) = √xconcave-down rootapproaches 0 verticallygrows, but slowly
n = 1f(x) = xstraight line, slope 1passes through originlinear growth
n = 2f(x) = x²parabola (concave up)flat at originfast growth, ×4 per ×2 of x
n = 3f(x) = x³cubicvery flat at originvery fast growth, ×8 per ×2 of x
n = -1f(x) = 1/xhyperbola, two branchesvertical asymptoteapproaches 0 horizontally
n = -2f(x) = 1/x²tall hyperbola, both branches positivevertical asymptoteapproaches 0 faster

The three regimes you should always recognize

n > 1 — accelerating growth

The function grows faster than its input. Doubling xx more than doubles f(x)f(x).

Real example: kinetic energy 12mv2\tfrac{1}{2}mv^{2}. Double the speed, quadruple the energy. That's why a 60-mph crash is 4× worse than a 30-mph one.

0 < n < 1 — diminishing returns

The function grows, but each new unit of xx gives less than the last.

Real example: perceived loudness \propto sound pressure0.6{}^{0.6}. Crank a stereo from 10 W to 100 W and it sounds only about 4× louder, not 10×.

n < 0 — decay with a wall

The function decreases as xx grows, and explodes near zero. There is a vertical asymptote at x=0x = 0.

Real example: light from a bulb falls off as 1/r21/r^{2}. Step twice as far away and it's 4× dimmer.


Symmetry: Even, Odd, and Neither

When nn is an integer, the parity of nn controls the symmetry of the graph:

  • n even (n = 2, 4, 6, …): the graph is symmetric about the y-axis. f(x)=f(x)f(-x) = f(x). Negative inputs produce the same output as their positives.
  • n odd (n = 1, 3, 5, …): the graph is symmetric about the origin. f(x)=f(x)f(-x) = -f(x). A rotation by 180° leaves the graph unchanged.
  • n not an integer (e.g., n = 0.5): the function isn't even defined for negative xx in the real numbers, because (1)1/2(-1)^{1/2} isn't real. Restrict the domain to x0x \ge 0.

A trick for parity

Why does n even give f(x)=f(x)f(-x) = f(x)? Because (x)n=(1)nxn(-x)^{n} = (-1)^{n} \cdot x^{n}, and (1)n(-1)^{n} is +1+1 for even nn, 1-1 for odd. The sign collapses for even, flips for odd. That single line of algebra explains every symmetry you saw.


Worked Example: f(x) = 2x³

Let's put one specific power function under the microscope. Take f(x)=2x3f(x) = 2x^{3} — a cubic with vertical stretch k=2k = 2. We'll evaluate it, compute its slope at three points using the power rule, and verify every number against an explicit table.

▸ Click to expand the full hand calculation

Step 1 — Evaluate the function

Plug each xx into f(x)=2x3f(x) = 2x^{3}. By hand:

f(0.5) = 2 · (0.5)³ = 2 · 0.125 = 0.25
f(1)   = 2 · (1)³   = 2 · 1   = 2
f(2)   = 2 · (2)³   = 2 · 8   = 16
f(3)   = 2 · (3)³   = 2 · 27  = 54

Step 2 — Find the derivative

The power rule (we'll prove it from first principles in Chapter 4) says ddxxn=nxn1\frac{d}{dx}\,x^{n} = n\,x^{n-1}. Combine with the constant multiple rule:

f(x)=23x31=6x2f'(x) = 2 \cdot 3x^{3-1} = 6x^{2}

Step 3 — Evaluate the slope at each point

f'(0.5) = 6 · (0.5)² = 6 · 0.25 = 1.5
f'(1)   = 6 · (1)²   = 6 · 1    = 6
f'(2)   = 6 · (2)²   = 6 · 4    = 24
f'(3)   = 6 · (3)²   = 6 · 9    = 54

Step 4 — Put it in a table

xf(x) = 2x³f'(x) = 6x²Interpretation
0.50.251.5shallow slope — curve is nearly flat
126moderate slope — curve picking up speed
21624steep slope — curve rising fast
35454slope equals value (coincidence at x = 3)

Step 5 — Sanity-check with a numerical limit

At x=2x = 2, the slope should be 24. Let's verify via a small secant. Take h=0.001h = 0.001:

f(2 + 0.001) = 2 · (2.001)³ = 2 · 8.012006001 ≈ 16.024012
f(2)  = 16
[f(2.001) − f(2)] / 0.001 ≈ 0.024012 / 0.001 = 24.012

The secant slope 24.012 is within 0.05% of the true derivative 24. That gap closes to zero as h0h \to 0 — the same limit we'll build the entire theory of derivatives from in Chapter 4.

Take-away: the same exponent that defines ff also dictates its slope. Power functions are the simplest functions whose derivative stays inside the same family — differentiate x3x^{3} and you get 3x23x^{2}, still a power function.


The Log-Log Trick — How Scientists Discover Hidden Power Laws

Suppose you measure a quantity yy at several values of xx and suspect a power law relation y=kxny = k\,x^{n}, but you don't know nn. The whole experiment looks like a curved blob on a regular plot. There is a beautiful trick — old, simple, and used everywhere from astrophysics to ML scaling laws — that turns the curve into a straight line.

The derivation in three lines

Start from the hypothesis. Take the logarithm of both sides. Use the identity log(ab)=loga+logb\log(ab) = \log a + \log b and log(xn)=nlogx\log(x^{n}) = n\log x:

y=kxny = k\,x^{n}
logy=logk+nlogx\log y = \log k + n\,\log x

Now substitute Y=logyY = \log y, X=logxX = \log x, b=logkb = \log k:

Y=b+nXY = b + n\,X

That is a straight line with slope nn and intercept b=logkb = \log k. Plotting your data on log-log axes turns the "is this a power law?" question into the much easier "does this look like a straight line?".

The Log-Log Trick — power laws become straight lines

slide n. watch the right plot stay perfectly straight.
linear axes: y = 2 · x^1.50
x → 100y
log-log axes: log y = log 2 + 1.50 · log x
log₁₀ xlog₁₀ yslope = 1.50

Reading a log-log plot

  • Slope = exponent of the power law.
  • Intercept = log of the coefficient. Exponentiate to recover kk.
  • If the cloud is straight, your hypothesis is supported. If it's curved, the law isn't a pure power — perhaps an exponential, perhaps a power law with a cutoff.

Scaling Laws in the Wild

Power functions describe nature's favorite kind of relationship: when one quantity is a fixed-power function of another. Here are four you'll meet again.

1. Kepler's third law — orbital period vs distance

For any planet orbiting the Sun, T2=a3T^{2} = a^{3} when TT is in years and aa is the semi-major axis in astronomical units. Equivalently:

T=a3/2T = a^{3/2}
Planeta (AU)Predicted T = a^(3/2)Actual T (years)
Mercury0.3870.24080.241
Earth1.0001.00001.000
Mars1.5241.88141.881
Jupiter5.20311.868111.86
Neptune30.07164.892164.79

Kepler arrived at this empirically in 1619 — a century before Newton showed it falls out of gravity being 1/r21/r^{2}. Two power laws nested inside each other.

2. The inverse-square law — light, gravity, radio

A point source spreads its energy over the surface of a sphere of radius rr. Surface area is 4πr24\pi r^{2}, so intensity must be 1/r2\propto 1/r^{2}:

I(r)=P4πr2I(r) = \frac{P}{4\pi r^{2}}
Distance r (m)Relative intensity 1/r²
11.0000
20.2500
30.1111
50.0400
100.0100

Step twice as far from the source, get one quarter the brightness. Step ten times farther, get one hundredth. That single number n=2n = -2 explains why the night sky is dark and why your phone's flashlight is useless past a few meters.

3. Kleiber's law — metabolism vs body mass

Across mammals from mice to elephants, the resting metabolic rate scales as:

RM3/4R \propto M^{3/4}
AnimalMass M (kg)Relative metabolism M^(0.75)
Shrew0.020.053
Rabbit11.00
Human7024.20
Elephant4000502.97

An elephant is 200,000× heavier than a rabbit but burns only ~500× more energy per second. Cells in big animals work slower, and that single 3/4 exponent is the reason a mouse's heart races at 600 bpm while an elephant's plods at 30.

4. Neural-network scaling laws

A 21st-century example: empirically, the loss of a well-trained transformer language model decreases as a power of the number of parameters:

L(N)L+(NcN)αL(N) \approx L_{\infty} + \left(\frac{N_{c}}{N}\right)^{\alpha}

with α0.076\alpha \approx 0.076. Doubling parameters knocks the loss down by a fixed factor — the same algebra Kepler used for planets, applied to GPT-class models.


The Square–Cube Law — A Power Function Battle

Two power functions, fighting each other. Take a sphere of radius rr:

  • surface area grows like r2r^{2}: A=4πr2A = 4\pi r^{2}
  • volume grows like r3r^{3}: V=43πr3V = \tfrac{4}{3}\pi r^{3}

The ratio surface-to-volume is what really matters for heat loss, oxygen exchange, and structural load. Divide:

AV=4πr243πr3=3r\frac{A}{V} = \frac{4\pi r^{2}}{\tfrac{4}{3}\pi r^{3}} = \frac{3}{r}

That "3/r" is itself a power function with n=1n = -1. So as creatures get bigger, their surface-to-volume ratio shrinks like 1/r1/r. Slide the radius and watch the numbers.

Square–Cube Law — why mice can't be elephants

drag radius r. volume races ahead of surface area.
ball of radius r = 1.00
surface area = 4 π r² = 12.57
volume = (4/3) π r³ = 4.19
ratio SA/V = 3 / r = 3.0000

Notice: doubling r doubles the ratio's denominator, so SA/V is cut in half. Big animals keep heat in (small SA/V). Small animals lose heat fast (huge SA/V). Same math.

Consequences of one little exponent

  1. Mice can't be elephants. Surface area per kilogram drops with size, so a giant mouse would overheat — its metabolism (per cell) wouldn't change but its ability to shed heat would collapse.
  2. Elephants can't be mice. Bone cross-section scales like length2, but body weight like length3. Scale a mouse up 1000× and its leg bones would shatter under its own weight.
  3. Why insects have no lungs. Their tiny size gives them enormous surface-to-volume ratio. Oxygen diffuses through the body wall fast enough; no pump needed.

Calculus Preview: The Power Rule

Every power function has an absurdly clean derivative. We'll prove it carefully in Chapter 4 using limits, but you can already use it:

ddxxn=nxn1\frac{d}{dx}\,x^{n} = n\,x^{n-1}

Combined with the constant-multiple rule (which we'll also justify):

ddx(kxn)=knxn1\frac{d}{dx}\,\bigl(k\,x^{n}\bigr) = k\,n\,x^{n-1}

Why does this make sense?

Look back at the explorer with the tangent on. At x0=1x_{0} = 1, the slope is knk\cdot n. So:

  • For f(x)=x2f(x) = x^{2} at x=1x = 1, slope = 2.
  • For f(x)=x3f(x) = x^{3} at x=1x = 1, slope = 3.
  • For f(x)=1/xf(x) = 1/x at x=1x = 1, slope = −1.

Higher exponent ⇒ steeper at the pivot. That is exactly what your eye sees in the interactive plot.

Why it generalizes

The power rule holds for every real nn — positive, negative, fractional, irrational. The proof for integer nn uses the binomial theorem; for n=1/qn = 1/q uses implicit differentiation; and for general real nn uses the trick xn=enlnxx^{n} = e^{n\ln x}. We'll do all three in Chapter 4.


Python: Plotting the Family

Time to translate the math into code. The following script draws six members of the power-function family on a single axis. Read along with the side-by-side cards on the left — every line is annotated, including every NumPy function and its arguments.

Drawing the Power Function Family
🐍power_family.py
1Import NumPy

NumPy gives us vectorized math. np.power(x, n) computes x^n element-wise on an array — no loop required.

EXAMPLE
np.power(np.array([1, 2, 3]), 2) → array([1, 4, 9])
2Import Matplotlib

matplotlib.pyplot is the standard 2D plotting library. plt.plot draws lines, plt.scatter draws points, plt.show renders the figure.

4Define the power function

We give the function a default coefficient k = 1.0 so calling power(x, n) without k recovers the pure shape x^n. This is the same f(x) = k·x^n we&apos;ve been studying mathematically.

EXECUTION STATE
x = array of 400 points in (0, 4]
n = scalar exponent
k = 1.0 by default
5📚 np.power(base, exponent)

📚 Element-wise exponentiation. Works on scalars, arrays, broadcasted shapes — and crucially, fractional and negative exponents.

EXAMPLE
np.power(2.0, 0.5) → 1.4142 (square root). np.power(2.0, -1) → 0.5 (reciprocal).
8📚 np.linspace(start, stop, num)

📚 Builds an array of num evenly spaced numbers from start to stop. We start at 0.01 (not 0) to avoid the singularity of 1/x and 1/x² at the origin.

EXAMPLE
np.linspace(0.01, 4, 5) → [0.01, 1.0075, 2.005, 3.0025, 4.0]
10Pick six exponents

These six values let us see every qualitative behavior in one plot: decay (n < 0), root (0 < n < 1), linear (n = 1), super-linear growth (n > 1).

EXECUTION STATE
exponents = [-2, -1, 0.5, 1, 2, 3]
11Human-readable labels

Matplotlib will print these in the legend. Keeping them next to the exponent list (same order) avoids accidental mismatches.

12Color palette

Tailwind-style hex codes. Warm colors (red, orange) for decay; cool colors (green, blue, purple) for growth. The visual gradient reinforces what each exponent means.

16Create the figure

figsize=(10, 6) requests a 10×6 inch canvas. matplotlib gives us a wide aspect ratio so the family fans out clearly.

17Loop over the family

zip pairs the three lists element-wise. One iteration draws one curve.

LOOP TRACE · 6 iterations
Iteration 1 — n = -2
n = -2
label = "1/x^2"
y at x=1 = 1.0
y at x=2 = 0.25
y at x=0.5 = 4.0
Iteration 2 — n = -1
n = -1
label = "1/x"
y at x=1 = 1.0
y at x=2 = 0.5
y at x=0.5 = 2.0
Iteration 3 — n = 0.5
n = 0.5
label = "sqrt(x)"
y at x=1 = 1.0
y at x=4 = 2.0
y at x=0.25 = 0.5
Iteration 4 — n = 1
n = 1
label = "x"
y at x=1 = 1.0
y at x=2 = 2.0
y at x=3 = 3.0
Iteration 5 — n = 2
n = 2
label = "x^2"
y at x=1 = 1.0
y at x=2 = 4.0
y at x=3 = 9.0
Iteration 6 — n = 3
n = 3
label = "x^3"
y at x=1 = 1.0
y at x=2 = 8.0
y at x=3 = 27.0
18Compute y = x^n

power(x, n) returns a new 400-length array. Each entry is x[i]^n. Vectorized, so the whole curve is computed in one C-level call — no Python loop.

19Plot the curve

linewidth=2 makes the line bold; label= is what shows in the legend; color= ties the curve to our palette.

22Mark the universal anchor (1, 1)

Every member of x^n passes through (1, 1) because 1^n = 1 for any n. This is the geometric &apos;pivot&apos; of the whole family. Marking it makes the pivot visible.

EXAMPLE
1^-2 = 1, 1^0.5 = 1, 1^3 = 1 — all the same point.
26📚 plt.xlim, plt.ylim

📚 Clamp the visible window. Without these, n = 3 would shoot to 64 and squash everything else into a flat line at the bottom.

31📚 plt.grid(True, alpha=0.3)

📚 Faint grid lines (30% opacity). Helps the eye estimate slope without overpowering the curves.

32Render

plt.show() opens the figure window (or displays inline in a notebook). After this call the figure is drawn; nothing happens before.

15 lines without explanation
1import numpy as np
2import matplotlib.pyplot as plt
3
4def power(x, n, k=1.0):
5    """f(x) = k * x^n — the general power function."""
6    return k * np.power(x, n)
7
8x = np.linspace(0.01, 4, 400)
9
10exponents = [-2, -1, 0.5, 1, 2, 3]
11labels    = ["1/x^2", "1/x", "sqrt(x)", "x", "x^2", "x^3"]
12colors    = ["#ef4444", "#f97316", "#eab308",
13             "#22c55e", "#3b82f6", "#8b5cf6"]
14
15plt.figure(figsize=(10, 6))
16for n, label, color in zip(exponents, labels, colors):
17    y = power(x, n)
18    plt.plot(x, y, color=color, linewidth=2, label=label)
19
20# Every member of the family passes through (1, 1) when k = 1
21plt.scatter([1], [1], color="white", edgecolors="black",
22            s=80, zorder=5, label="(1, 1)")
23
24plt.xlim(0, 4)
25plt.ylim(0, 6)
26plt.xlabel("x")
27plt.ylabel("f(x) = x^n")
28plt.title("The Power Function Family")
29plt.legend()
30plt.grid(True, alpha=0.3)
31plt.show()

Python: Discovering an Exponent from Data

Now the inverse problem: given a cloud of measurements, what power law generated them? The log-log trick makes this a one-line linear fit. We'll use synthetic data y=2x1.5y = 2\,x^{1.5} so you can verify the fit recovers the truth.

Fitting an Unknown Power Law
🐍power_law_fit.py
1Import NumPy

We&apos;ll lean on three things from NumPy: array math, np.log10, and np.polyfit (a one-call least-squares straight-line fit).

4Pretend-measured x values

Five sample points spanning two orders of magnitude. Real-world power laws are usually invisible on a single scale — you need the wide span to see them.

EXECUTION STATE
x = [1.0, 2.0, 4.0, 10.0, 100.0]
5Pretend-measured y values

These are y = 2 · x^1.5 evaluated exactly. In a real experiment they&apos;d carry noise; we use clean values so the fit is exact and you can see the mechanism.

EXECUTION STATE
y = [2.0, 5.6569, 16.0, 63.2456, 2000.0]
8The log trick (intuition)

If y = k · x^n then taking log of both sides turns multiplication into addition and exponentiation into multiplication. The curved power-law becomes a straight line — easy to fit.

EXAMPLE
log(k · x^n) = log(k) + n · log(x).
10📚 np.log10(x)

📚 Element-wise base-10 logarithm. Works on any positive array. We use log10 (not natural log) only because the resulting numbers are friendlier to read.

EXECUTION STATE
log_x = [0.0000, 0.3010, 0.6021, 1.0000, 2.0000]
11Logs of the responses

Same operation applied to y. After this line, (log_x, log_y) is a set of five points that, if our data really is a power law, lie on a perfect line.

EXECUTION STATE
log_y = [0.3010, 0.7526, 1.2041, 1.8010, 3.3010]
14📚 np.polyfit(x, y, deg)

📚 Least-squares polynomial fit. With deg=1 it returns [slope, intercept] of the best straight line. The slope is our exponent; the intercept is log(k).

EXAMPLE
np.polyfit([0, 1, 2], [1, 3, 5], 1) → array([2., 1.]) — slope 2, intercept 1.
17Recover n

The slope of the log-log line is exactly the exponent n. Our fit gives n_hat = 1.5000, matching the truth.

EXECUTION STATE
n_hat = 1.5000
18Recover k

The intercept is log10(k), so we exponentiate: k_hat = 10^intercept. Result: 2.0000, matching the truth.

EXECUTION STATE
k_hat = 2.0000
20Print the comparison

Always sanity-check the recovered constants against the known values. In a real experiment you don&apos;t have ground truth — but if the residual log-log scatter is small, the fit is trustworthy.

11 lines without explanation
1import numpy as np
2
3# Synthetic measurements: y = 2 * x^1.5 (we&apos;ll pretend we don&apos;t know n)
4x = np.array([1, 2, 4, 10, 100], dtype=float)
5y = np.array([2.0, 5.6569, 16.0, 63.2456, 2000.0])
6
7# Step 1 — take logs of both sides
8#   y = k * x^n
9#   log y = log k + n * log x
10log_x = np.log10(x)
11log_y = np.log10(y)
12
13# Step 2 — fit a straight line through (log_x, log_y)
14slope, intercept = np.polyfit(log_x, log_y, 1)
15
16# Step 3 — read off the recovered constants
17n_hat = slope
18k_hat = 10 ** intercept
19
20print(f"recovered n = {n_hat:.4f}   (true value: 1.5000)")
21print(f"recovered k = {k_hat:.4f}   (true value: 2.0000)")

Run it locally and you'll see:

recovered n = 1.5000   (true value: 1.5000)
recovered k = 2.0000   (true value: 2.0000)

Common Pitfalls

Power ≠ Exponential

The number-one freshman mistake. x2x^{2} is a power function; 2x2^{x} is an exponential. Their growth rates diverge wildly — for large xx the exponential always wins.

Negative bases with fractional exponents are not real

(4)1/2=4(-4)^{1/2} = \sqrt{-4} is not a real number. If nn isn't an integer, restrict the domain to x0x \ge 0 (or accept complex outputs).

The point x = 0 is special for negative n

xnx^{n} with n<0n < 0 is undefined at x=0x = 0. The function has a vertical asymptote there. Don't evaluate it at zero; don't fit it near zero without thinking.

np.power vs `**` in Python

For pure arrays, both np.power(x, n) and x**n compute element-wise powers. They differ in two places: np.power handles broadcasting more flexibly and gives clearer errors for invalid combinations like np.power(-2, 0.5), which returns nan with a warning. Use whichever reads more clearly — but prefer np.power when the exponent is a NumPy array too.


Summary

Power functions are the "one knob" family. The single exponent nn controls everything about the shape and is the reason this family describes phenomena from planets to mice to language models.

Key formulas

FormulaMeaning
f(x) = k · x^nGeneral power function
log y = log k + n · log xLog-log linearization
d/dx (x^n) = n · x^(n-1)Power rule (preview)
A/V = 3/rSquare–cube law for a sphere
T² = a³Kepler's third law
I ∝ 1/r²Inverse-square law

Key takeaways

  1. A power function is f(x)=kxnf(x) = k\,x^{n}: variable base, constant exponent. Not the same as an exponential.
  2. The exponent nn alone decides whether you get growth, decay, a root, a line, or a hyperbola.
  3. Every curve in the family pivots through (1,k)(1, k).
  4. Even integer nn ⇒ y-axis symmetry. Odd integer nn ⇒ origin symmetry.
  5. The log-log trick turns any power law into a straight line of slope nn. This is how exponents are measured in experiments.
  6. Scaling laws govern biology (Kleiber), physics (inverse-square), astronomy (Kepler), and modern ML (neural scaling laws).
  7. The power rule ddxxn=nxn1\frac{d}{dx}\,x^{n} = n\,x^{n-1} will carry us through all of differential calculus.
The essence of power functions:
"One exponent. Infinite shapes. The whole zoo of nature's scaling behaviors — from a falling apple to a galaxy's rotation curve — sits inside the single formula f(x) = k · x^n."
Coming Next: Now that you can read the shape of any power function at a glance, we'll meet a different beast — exponential functions — where the variable lives in the exponent and growth becomes truly explosive.
Loading comments...