Seasonal Temperature Physics and 20-Year Compound Growth
Medium · Software Engineering Fundamentals · Data Engineer · Onsite
Prompt
Work through both parts below clearly from first principles:
- Seasonal temperatures: Explain the physical reasons why a region experiences warmer weather in summer than in winter.
- Exponential compounding: You place $1,000 into an account earning a 100% annual return, credited once a year, with zero withdrawals or additions. What is the account balance after 20 years, and what modeling assumptions underpin that figure?
Scope & Expectations
- Explain the astronomical geometry driving seasonal heating differences and address common misconceptions carefully.
- Set up the compounding recurrence cleanly, compute both an intuitive mental-math estimate and the exact 20-year balance, and contrast exponential growth with linear intuition.
- State the financial and timing assumptions—such as deposit timing, taxes, fees, and inflation—that materially affect the final balance.
Step-by-step walkthrough
Part 1 — Seasons come from Earth's 23.4° axial tilt
Earth's spin axis is not straight up and down relative to its orbit around the Sun—it is tilted by about 23.4° (axial tilt). Like a gyroscope, that axis stays pointed toward the same direction in space (near Polaris, the North Star) all year long as Earth circles the Sun:
June solstice December solstice (Northern Hemisphere summer) (Northern Hemisphere winter) N N / / Sun O <-- North leans toward Sun North leans O <-- Sun / South leans away away from Sun / S SBecause of this fixed tilt, whichever hemisphere leans toward the Sun experiences two geometric effects at the same time:
- The Sun climbs much higher in the sky, concentrating its wattage onto a smaller patch of ground and passing through less atmosphere.
- The Sun stays above the horizon for more hours each day, giving the ground longer to warm up and less night time to cool down.
Both effects reinforce each other to deliver far more solar energy per square meter each day in summer than in winter.
Effect 1: a higher Sun concentrates sunlight per square meter
Imagine shining a flashlight straight down (
90°) onto a tabletop: the beam makes a tight, bright circle. Now tilt that exact same flashlight down to a shallow27°angle: the same light smears out into a wide oval covering more than twice the area, so every square centimeter receives less than half as much power.High summer Sun (steep angle): Low winter Sun (shallow angle): | | | / / / v v v / / / ============= ========================= [1 m² patch ] [same beam spread > 2 m²]On flat ground, the solar power per square meter scales with
sin(solar_elevation), where solar elevation is the Sun's angle above the horizon. At solar noon, elevation depends on your latitude and the Sun's declination (the latitude where the Sun sits directly overhead at noon, swinging from+23.4°on the June solstice to-23.4°on the December solstice):noon_elevation = 90° - |latitude - declination|Work through a concrete example at 40° N (roughly New York, Madrid, or Beijing):
June solstice noon: 90° - |40° - (+23.4°)| = 73.4° -> sin(73.4°) ≈ 0.96 December solstice noon: 90° - |40° - (-23.4°)| = 26.6° -> sin(26.6°) ≈ 0.45 Noon ground-flux ratio: 0.96 / 0.45 ≈ 2.1×At noon alone, each square meter at
40° Ncatches 2.1 times as much direct solar power in June as in December—even before counting Earth's atmosphere. Because a26.6°winter beam slices diagonally through more than twice the thickness of air (1 / sin(26.6°) ≈ 2.2atmospheres vs1.04in June), extra scattering and absorption widen the gap at ground level further still.Effect 2: longer summer days add more hours of heating
Leaning toward the Sun also shifts more of your latitude circle into Earth's sunlit half, stretching daylight hours. Earth rotates
360° / 24 h = 15° per hour, and spherical geometry gives the sunrise-to-noon half-day angleH0viacos(H0) = -tan(latitude) × tan(declination):import math def noon_elevation_deg(latitude_deg: float, declination_deg: float) -> float: """Solar elevation above the horizon at local solar noon (clamped at 0 for polar night).""" return max(0.0, 90.0 - abs(latitude_deg - declination_deg)) def day_length_hours(latitude_deg: float, declination_deg: float) -> float: """Geometric daylight duration in hours (ignoring small atmospheric refraction).""" lat_rad = math.radians(latitude_deg) dec_rad = math.radians(declination_deg) # Clamp to [-1, 1] so polar midnight sun (24 h) and polar night (0 h) never fail acos. cos_half_day = max(-1.0, min(1.0, -math.tan(lat_rad) * math.tan(dec_rad))) half_day_deg = math.degrees(math.acos(cos_half_day)) return 2.0 * half_day_deg / 15.0 print(round(noon_elevation_deg(40, 23.44), 1)) # 73.4 deg in June print(round(noon_elevation_deg(40, -23.44), 1)) # 26.6 deg in December print(round(day_length_hours(40, 23.44), 1)) # 14.8 hours in June print(round(day_length_hours(40, -23.44), 1)) # 9.2 hours in DecemberCombining steeper sunlight with
14.8 hoursvs9.2 hoursof daylight, a square meter at the top of the atmosphere above40° Nreceives more than 3 times as much daily solar energy in June as in December (~3.3×from geometry alone,~3.1×after accounting for orbit distance).Why Earth–Sun distance is not the cause (plus seasonal lag)
The most common misconception is that Earth orbits closer to the Sun in summer. Three quick checks disprove it immediately:
- Opposite hemispheres at the same time: When it is hot July summer in New York, it is cold winter in Sydney and Buenos Aires—yet the entire planet is at the exact same distance from the Sun.
- Wrong time of year: Earth's orbit is slightly elliptical, reaching perihelion (closest point,
~147.1 million km) in early January—northern winter—and aphelion (farthest point,~152.1 million km) in early July. - Too small to drive seasons: That
3.3%distance swing changes sunlight intensity (which follows an inverse-square law,1 / distance²) by(152.1 / 147.1)² ≈ 1.07, or only ~7%—tiny next to the>300%mid-latitude swing from axial tilt.
One bonus physical detail rounds out a strong answer: seasonal lag. Even though daily sunlight peaks around June 21 in the north, the hottest weeks usually arrive in late July or August. Land and especially oceans store huge amounts of heat—like a pot of water on a stove, surface temperatures keep climbing past peak sunlight for as long as daily heat absorbed still exceeds daily heat radiated back to space.
Part 2 — Compound interest: turn yearly doubling into powers of two
Compound interest means each year's interest is added to your balance so that future years earn interest on both your original deposit (principal) and all previously earned interest. Compounding once per year at rate
rmultiplies the balance by(1 + r)each year:A = P × (1 + r)^nHere
P = $1,000,r = 100% = 1.00, andn = 20 years, so(1 + r) = 2—the account doubles every single year:End of Year 0 (start): $1,000 End of Year 1: $1,000 × 2^1 = $2,000 End of Year 2: $1,000 × 2^2 = $4,000 End of Year 3: $1,000 × 2^3 = $8,000 ... End of Year 10: $1,000 × 2^10 = $1,000 × 1,024 = $1,024,000 End of Year 20: $1,000 × 2^20 = $1,000 × 1,048,576 = $1,048,576,000Using the mental-math anchor
2^10 = 1,024 ≈ 10^3, squaring gives2^20 = 1,024 × 1,024 = 1,048,576 ≈ 1.05 × 10^6. Multiplying by$1,000yields $1,048,576,000—just under $1.05 billion (compared with$1,000 + 20 × $1,000 = $21,000under non-compounded simple interest).State every assumption that changes the final figure
Because exponential growth magnifies small rule changes into massive dollar differences, state every assumption explicitly:
- Deposit and credit timing (20 full periods): We assume
$1,000is invested att = 0(the very start of Year 1) and interest is credited at the end of Years 1 through 20. If the deposit happened at the end of Year 1 (only 19 compoundings), the total would drop in half to$524,288,000. - Zero taxes, fees, or withdrawals: Every dollar stays invested untaxed. If annual gains were taxed at 20% each year, the effective rate would drop from
100%to80%, shrinking the Year-20 balance by more than8×to$1,000 × 1.8^20 ≈ $127.5 million. - Constant 100% rate with zero default risk: Treated purely as a math problem—in real markets, no strategy compounds
$1,000into$1 billionrisk-free at 100% per year. - Nominal vs real (inflation-adjusted) dollars:
$1,048,576,000is in nominal Year-20 dollars. At3%annual inflation, prices rise by1.03^20 ≈ 1.81, so the purchasing power in today's (real) dollars is roughly$581 million. - Compounded once per year: As stated in the prompt; monthly or continuous compounding at a 100% nominal annual rate would yield hundreds of billions instead.
- Deposit and credit timing (20 full periods): We assume
Financial precision in code: avoid binary floats for money
In a Data Engineer interview, briefly note how to implement interest calculations safely in production pipelines. Standard binary floating-point numbers (
float) store base-2 fractions and cannot represent most decimal cents like0.10exactly (0.1 + 0.2evaluates to0.30000000000000004). Always represent money using integer cents or base-10Decimalarithmetic with an explicit business rounding rule:from decimal import Decimal, ROUND_HALF_UP CENT = Decimal("0.01") def compound_annually(principal: str, annual_rate: str, years: int) -> Decimal: """Compute balance after `years` annual compoundings, rounded to cents each year.""" balance = Decimal(principal) multiplier = Decimal("1") + Decimal(annual_rate) for _ in range(years): balance = (balance * multiplier).quantize(CENT, rounding=ROUND_HALF_UP) return balance print(compound_annually("1000.00", "1.00", 20)) # 1048576000.00 print(compound_annually("1000.00", "1.00", 19)) # 524288000.00
Intuition & how it works
Both parts test whether you can reason from first principles instead of falling for everyday myths:
- For seasons, picture shining a flashlight onto a flat floor. Pointed straight down, the beam concentrates all its heat onto a small bright circle; tilted to a low slant, that exact same beam smears thinly across more than twice the floor area. Earth's 23.4° axial tilt (the angle of Earth's spin axis relative to its orbit) tilts your hemisphere toward the Sun in summer—making the Sun both climb higher in the sky (concentrating wattage per square meter) and stay above the horizon for more hours.
- For compound interest, picture folding a sheet of paper in half 20 times. Each fold doubles the stack's thickness, so 20 doublings multiply your starting
$1,000not by20, but by2^20 = 1,048,576.
Naive intuition fails badly on both prompts. Many people guess summer is hotter because Earth orbits closer to the Sun, which collapses immediately once you remember that New York's summer happens on the exact same day as Sydney's winter—and Earth is actually closest to the Sun in early January! On the financial prompt, human intuition defaults to linear simple interest ($1,000 + 20 × $1,000 = $21,000), underestimating exponential compounding by nearly 50,000×.
A tiny numeric trace makes both mechanisms concrete:
- Seasons at
40° N: On the June solstice, the noon Sun sits at73.4°above the horizon (sin 73.4° ≈ 0.96) and shines for14.8 hours; on the December solstice, it reaches only26.6°(sin 26.6° ≈ 0.45) for9.2 hours—delivering more than 3× as much solar energy per square meter across a summer day as a winter day. - Compounding
$1,000at100%:Year 0: $1,000 -> Year 1: $2,000 -> Year 2: $4,000 -> ... -> Year 10: $1,000 × 2^10 = $1,024,000 -> Year 20: $1,000 × 2^20 =$1,048,576,000 (~$1.05 billion).
Key points
- Axial tilt (
23.4°) drives seasons through two mechanisms. Leaning toward the Sun raises solar elevation (angle above the horizon, where ground power scales withsin(elevation)and steeper rays traverse less atmosphere) and lengthens daylight duration (14.8 hvs9.2 hat40° N). - Orbital distance is a distraction, not the cause. Earth reaches perihelion (closest point to the Sun,
~147.1M km) in early January and aphelion (farthest point,~152.1M km) in early July; the3.3%distance change alters solar flux by only~7%, and cannot produce opposite seasons in the Northern and Southern Hemispheres simultaneously. - Seasonal lag explains why July/August beat June. Land and oceans have large heat capacity (energy needed to raise their temperature), so temperatures continue rising past the June solstice for as long as daily heat absorbed exceeds daily heat radiated out.
- Exact compound-interest calculation:
A = P × (1 + r)^n = $1,000 × (1 + 1.0)^20 = $1,000 × 2^20 = $1,048,576,000. Memorize2^10 = 1,024 ≈ 10^3so2^20 = 1,024² ≈ 1.05 × 10^6is effortless without a calculator. - Assumptions dominate exponential models. Explicitly state: deposit at
t = 0with 20 full annual compoundings, zero taxes/fees/withdrawals, constant100%rate, nominal (not inflation-adjusted) dollars, and annual compounding.
Common mistakes
- Claiming Earth is closer to the Sun in summer—or that tilting makes a hemisphere "closer." Earth as a whole is farthest from the Sun in early July, and leaning a hemisphere by
23.4°shifts it by at most a few thousand kilometers out of150 million km(< 0.004%), which has virtually zero effect on sunlight intensity. Only the angle and duration of sunlight matter. - Citing only day length or only sun angle. Both stem from the
23.4°tilt and multiply together; at mid-latitudes, sun angle (plus atmospheric path length) is actually the larger factor. - Writing
90° - latitude + declinationblindly for noon sun angle. Inside the tropics or Southern Hemisphere, that unguarded formula can exceed90°; the right geometric relation is90° - |latitude - declination|. - Off-by-one exponent errors (
2^19or2^21). Forgetting whether "end of the 20th year" means 19 or 20 compoundings halves ($524.3M) or doubles ($2.10B) the result—always statet = 0deposit timing explicitly. - Applying the "Rule of 72" at a 100% rate. The Rule of 72 (
doubling_years ≈ 72 / rate_percent) relies on the small-rate calculus approximationln(1 + r) ≈ r(r << 1). At100%,72 / 100 = 0.72 yearsis wrong—annual compounding at100%doubles in exact 1.00 year. - Using binary
floatfor financial balances in code. Base-2 floats introduce silent cent-rounding drift on decimal rates like3.5%; usedecimal.Decimalor integer cents.
Follow-up questions
- After how many full years does that $1,000 balance first cross the $1,000,000 mark? We need
$1,000 × 2^n > $1,000,000(or≥depending on phrasing), which simplifies to2^n > 1,000. Since2^9 = 512gives$512,000at the end of Year 9 and2^10 = 1,024gives$1,024,000at the end of Year 10, the account first exceeds$1 millionat the end of Year 10 (n = ceil(log2(target / principal))). - How would the 20-year ending balance change if the 100% nominal annual rate were compounded monthly or continuously instead? A nominal annual rate of
100%split across12months credits1/12 ≈ 8.33%per month for240months, multiplying each year by(1 + 1/12)^12 ≈ 2.613instead of2and growing to$1,000 × (13/12)^240 ≈ $220.2 billion. Under continuous compounding (the mathematical limit as compounding happens every instant, governed by Euler's constante ≈ 2.71828), each year multiplies bye^1 ≈ 2.718and the 20-year balance hits$1,000 × e^20 ≈ $485.2 billion—more than460×the annual-compounding total! - Why do coastal cities experience milder summers and winters—and a later peak temperature—than inland cities at the same latitude? Water has roughly
4×the specific heat capacity of dry rock/soil, is transparent enough for sunlight to warm tens of meters deep, and mixes heat downward via waves and currents. As a result, oceans warm up much more slowly in spring/summer and release stored heat much more slowly in autumn/winter—keeping San Francisco cool into August/September while inland Sacramento peaks earlier and much hotter.
Follow-up questions
- After how many full years does that $1,000 balance first cross the $1,000,000 mark?
- How would the 20-year ending balance change if the 100% nominal annual rate were compounded monthly or continuously instead?
- Why do coastal cities experience milder summers and winters—and a later peak temperature—than inland cities at the same latitude?
Similar questions
- Stateful Pocket Calculator Engine
- Data Quality Validation for Payment Tables
- Polymorphism, Pointers, and References in C++
- CUDA Memory Coalescing and Tiled Matrix Transpose
- Simulating Go Sub-Slice Append Output
- Evaluating a Go Loop That Collects Pointers to Its Counter
More Zoox interview questions
- Fastest Strategy for Delivering a 2 TB Dataset Easy
- Robotaxi Teleoperations Schema and Fleet Stability Pipeline Medium
- Evaluating a Go Loop That Collects Pointers to Its Counter Medium Pro
- Simulating Go Sub-Slice Append Output Medium Pro
- Rapid-Fire Quantitative Estimation and Probability Puzzles Easy Pro
- Stateful Pocket Calculator Engine Hard Pro
- Meeting Time of Two Grid Vehicles Hard Pro
- Coaster Telemetry Scoring Engine Medium Pro
- Bayesian Inference for a Weighted Coin Medium Pro
- Navigating a High-Stakes Analytical Disagreement With Stakeholders Medium Pro