Why your average beats the average price
The last two rows are the interesting ones, and they are never equal. A fixed spend buys more units when the price is low and fewer when it is high, so your money is weighted towards the cheap days without you doing anything. That pulls the price you paid below the simple average of the prices you paid it at.
Buy $100 a week for a year while the price falls from $95,000 to $77,000 and the prices average $86,000 — but you paid $85,673. The gap widens the more violently the price swings, which is the honest argument for buying on a schedule in a volatile asset: it is not that it times the market, it is that a fixed budget times itself.
Questions people ask
Does it assume the price moved in a straight line?
Yes, and that is the limitation worth knowing. It walks evenly from the first price to the last, so it models the trend rather than the path. Real prices wander, and wandering makes the effect above stronger, not weaker — so treat this as the conservative version of the answer.
What if I bought while the price went up?
Put the lower price first. The maths is the same and the conclusion still holds: your average cost lands below the average price either way, because the weighting is about spend per unit, not direction.
Weekly or monthly — does it matter?
Less than people expect. Frequency changes how many data points you catch, not the underlying effect, and the difference between weekly and monthly over a year is usually a fraction of a percent. Set the number of buys to 52 for weekly or 12 for monthly and compare for yourself.