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:

  1. Seasonal temperatures: Explain the physical reasons why a region experiences warmer weather in summer than in winter.
  2. 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

  1. 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                                                       S
    

    Because of this fixed tilt, whichever hemisphere leans toward the Sun experiences two geometric effects at the same time:

    1. The Sun climbs much higher in the sky, concentrating its wattage onto a smaller patch of ground and passing through less atmosphere.
    2. 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.

  2. 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 shallow 27° 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° N catches 2.1 times as much direct solar power in June as in December—even before counting Earth's atmosphere. Because a 26.6° winter beam slices diagonally through more than twice the thickness of air (1 / sin(26.6°) ≈ 2.2 atmospheres vs 1.04 in June), extra scattering and absorption widen the gap at ground level further still.

  3. 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 angle H0 via cos(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 December
    

    Combining steeper sunlight with 14.8 hours vs 9.2 hours of daylight, a square meter at the top of the atmosphere above 40° N receives 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).

  4. 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.

  5. 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 r multiplies the balance by (1 + r) each year:

    A = P × (1 + r)^n
    

    Here P = $1,000, r = 100% = 1.00, and n = 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,000
    

    Using the mental-math anchor 2^10 = 1,024 ≈ 10^3, squaring gives 2^20 = 1,024 × 1,024 = 1,048,576 ≈ 1.05 × 10^6. Multiplying by $1,000 yields $1,048,576,000—just under $1.05 billion (compared with $1,000 + 20 × $1,000 = $21,000 under non-compounded simple interest).

  6. 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,000 is invested at t = 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% to 80%, shrinking the Year-20 balance by more than 8× 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,000 into $1 billion risk-free at 100% per year.
    • Nominal vs real (inflation-adjusted) dollars: $1,048,576,000 is in nominal Year-20 dollars. At 3% annual inflation, prices rise by 1.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.
  7. 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 like 0.10 exactly (0.1 + 0.2 evaluates to 0.30000000000000004). Always represent money using integer cents or base-10 Decimal arithmetic 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,000 not by 20, but by 2^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 at 73.4° above the horizon (sin 73.4° ≈ 0.96) and shines for 14.8 hours; on the December solstice, it reaches only 26.6° (sin 26.6° ≈ 0.45) for 9.2 hours—delivering more than 3× as much solar energy per square meter across a summer day as a winter day.
  • Compounding $1,000 at 100%: 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 with sin(elevation) and steeper rays traverse less atmosphere) and lengthens daylight duration (14.8 h vs 9.2 h at 40° 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; the 3.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. Memorize 2^10 = 1,024 ≈ 10^3 so 2^20 = 1,024² ≈ 1.05 × 10^6 is effortless without a calculator.
  • Assumptions dominate exponential models. Explicitly state: deposit at t = 0 with 20 full annual compoundings, zero taxes/fees/withdrawals, constant 100% 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 of 150 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 + declination blindly for noon sun angle. Inside the tropics or Southern Hemisphere, that unguarded formula can exceed 90°; the right geometric relation is 90° - |latitude - declination|.
  • Off-by-one exponent errors (2^19 or 2^21). Forgetting whether "end of the 20th year" means 19 or 20 compoundings halves ($524.3M) or doubles ($2.10B) the result—always state t = 0 deposit 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 approximation ln(1 + r) ≈ r (r << 1). At 100%, 72 / 100 = 0.72 years is wrong—annual compounding at 100% doubles in exact 1.00 year.
  • Using binary float for financial balances in code. Base-2 floats introduce silent cent-rounding drift on decimal rates like 3.5%; use decimal.Decimal or 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 to 2^n > 1,000. Since 2^9 = 512 gives $512,000 at the end of Year 9 and 2^10 = 1,024 gives $1,024,000 at the end of Year 10, the account first exceeds $1 million at 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 across 12 months credits 1/12 ≈ 8.33% per month for 240 months, multiplying each year by (1 + 1/12)^12 ≈ 2.613 instead of 2 and 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 constant e ≈ 2.71828), each year multiplies by e^1 ≈ 2.718 and the 20-year balance hits $1,000 × e^20 ≈ $485.2 billion—more than 460× 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

Similar questions

More Zoox interview questions

All 22 Zoox questions →