Unit Elasticity Calculation Question I'm struggling with a math concept dealing with unit elasticity at an undergraduate textbook level. In most problems, we are given a starting price and an ending price as well as corresponding quantities demanded. For example:

When bread was ${$2.00}$ a loaf Bobby wanted ${4}$ loaves, when bread prices raised to ${$2.50}$ Bobby wanted just ${2}$ loaves. What is bobby's price elasticity of demand?

To calculate these we say the percent change in price is ${\% \Delta P = \frac{$2.50-$2.00}{$2.00}=25\%}$. The percent change is measured relative to the starting price. Meanwhile ${\% \Delta Q = \frac{2-4}{4}=-50\%}$. Making elasticity ${-2.0}$.

However, I came across a problem where essentially it asked what is the elasticity for someone who wants to spend exactly ${$10}$ on gasoline. I first tried to think about this intuitively, "If price doubles, she'll be able to get half as much quantity no matter the starting price," which seems like elasticity of ${1}$. However, I set it up algebraically I get the following:
$${Q*P=10 \implies Q = 10/P}$$

So I put in some random values of ${P}$, for example ${P_1=$2.00}$ and ${P_2=$2.50}$ for ${\% \Delta P = \frac{$2.50-$2.00}{$2.00}=25\%}$. Meanwhile, For quantity we have ${Q_1 = \frac{10}{2}=5}$ and ${Q_2 = \frac{10}{2.5}=4}$. So that ${\% \Delta Q = \frac{4-5}{5}=-20\%}$.... Which isn't unit elastic.

So I turned to calculus and did the following:

$${Q(P)=\frac{10}{P} \implies \frac{dQ}{Q}*\frac{P}{dP}=\frac{dQ}{dP}*\frac{P}{\frac{10}{P}}=-\frac{10}{P^2}*\frac{P^2}{10}=-1.}$$

Which is unit elasticity. Clearly the discrepancy here is caused by the fact that the derivative has the "starting quantity" = "ending quantity" since it's the same point. But should we be measuring percent change relative to starting price and quantity? Or relative to starting price, but ending quantity? Or does it depend? And why?
You have to use the midpoint method to resolve this (if I recall correctly).

https://quickonomics.com/how-to-calculate-price-elasticities-using-the-midpoint-formula/

The reason I may not recall correctly is because the second you introduce calculus into the study of economics, you discard these formulae entirely and (try to) forget they ever existed.  You seem to already know calculus, which is probably causing you to be even more confused rather than less, and understandably so.

The primary purpose of these non-calculus formulations of elasticity is to teach you the intuition around what elasticity is as a concept - I definitely have strong opinions about how well it accomplishes that. :)

EDIT: Just wanted to add that, if indeed the problem is as you're saying it (come hell or high water, Billy is going to spend \$10 and only \$10 on gas) then your intuition is right - Billy has unit price elasticity of demand for gas, although in a kludgy sort of way.  This is supported by your calculus-based analysis.