Calculating Elasticity
The elasticity of some endogenous (dependent) variable $Y$ with respect to some exogenous (independent) variable $X$ may be written as \(\epsilon_{Y,X} = \frac{\%\Delta y}{\%\Delta x}\) The general way of defining a percentage change is that it’s the absolute change as a fraction of the “base” quantity involved, multiplied by 100%: that is, \(\%\Delta x = 100\% \times \frac{\Delta x}{x}\) \(\%\Delta y = 100\% \times \frac{\Delta y}{y}\) Plugging this expression into our formula for elasticity gives us \(\epsilon_{Y,X} = \frac{\%\Delta y}{\%\Delta x} = \frac{100\% \times \frac{\Delta y}{y}}{100\% \times \frac{\Delta x}{x}}\) We can rewrite this as \(\epsilon_{Y,X} = \frac{\Delta y}{\Delta x} \times \frac{x}{y}\) Note that this is related to but not equal to the absolute change in $Y$ per absolute change in $X$ given by $\Delta y / \Delta x$. In particular, for the special case where $y = x$, the elasticity and slope are the same thing. But if $y > x$, then the same absolute change would represent smaller percentage change in $Y$ than it would in $X$; so the elasticity would be less than $\Delta y/\Delta x$.
Example: Calculating the elasticity of demand from two points
Suppose the price of a good increased from €1.00 to €1.01, and this resulted in the quantity demanded decreasing from 50 million units to 48 million units. In this case we consider price to be the exogenous variable $X$ and quantity to be the endogenous variable $Y$; so using the formula above we have \(\begin{aligned} \Delta x &= €1.01  €1.00 = +€0.01\\ x &= €1.00\\ \Delta y &= 48 \text{ million units}  50 \text{ million units} = 2 \text{ million units}\\ y &= 50 \text{ million units} \end{aligned}\) We calculate the percentage change in price as \(\text{\% change in price} = 100\% \times \frac{\Delta x}{x} = 100\% \times \frac{+€0.01}{€1.00} = 1\%\) and the percent change in quantity as \(\text{\% change in quantity} = 100\% \times \frac{\Delta y}{y} = 100\% \times \frac{2 \text{ million units}}{50 \text{ million units}} = 4\%\) Therefore we would say that a 1% increase in the price led to a 4% decrease in the quantity demanded, so the elasticity (written $\epsilon$) would be $4$: \(\epsilon_{Q,P} = \frac{\text{\% change in quantity}}{\text{\% change in price}} = \frac{4\%}{+1\%} = 4\) We could also just plug this directly into the formula to obtain \(\epsilon_{Y,X} = \frac{\Delta y}{\Delta x} \times \frac{x}{y} = \frac{2 \text{ million units}}{+€0.01} \times \frac{€1.00}{50 \text{ million units}} = 4\)
Note that in each case all the units cancel, leaving the measure of elasticity as a unitless measure.
Evaluating elasticity for large changes: the “midpoint method”
The above example used small percentage changes in both price and quantity. A perennial problem for calculating percentages, though, is which quantity to use as the “basis,” especially when looking at large percentage change. For example, consider a variable that increases by 20, from 40 to 60. The way percentages are usually calculated, that’s a 50% increase, since $20/40 = 0.50$. However, now suppose the variable drops back down to 40. We’d usually refer to that as a 33% decrease, since $20/60 \approx 0.33$.
We generally don’t want to think of the elasticity between two points as depending on whether we’re starting at one or the other. One way of solving this problem, and getting consistent results, is to use the midpoint between the two as the basis. So in this case, to evaluate the change from 40 to 60, we’d use the midpoint of 50 (halfway between 40 and 60). Now either an increase of 20 or a decrease of 20 represents a 40% change, since $20/50 = 0.4$. (Note that this lies between the two values of 0.33 and 0.5 that we found before).
The following diagram can help illustrate how the midpoint method can be used to evaluate elasticities along a demand curve:
Evaluating elasticity for linear relationships: the “pointslope method”
One important special case of evaluating elasticity involves linear relatioships: that is, where $\Delta y/\Delta x$ is constant. For example, if we have \(y = mx + b\) In this case $\Delta y/\Delta x = m$, so \(\begin{aligned} \epsilon_{Y,X} &= \frac{\Delta y}{\Delta x} \times \frac{x}{y}\\ &= m \times \frac{x}{mx + b}\\ &= \frac{mx}{mx + b}\end{aligned}\) Notice that we plug in $y = mx + b$ for $y$ in order to express elasticity as a function of the independent variable $X$.
Example: Elasticity along a linear demand curve
One common linear relationship used throughout econ courses is a linear demand curve of the form (Q = a  bP), as shown in the diagram below. Try moving the price up and down to see the elasticity at different points along the demand curve:
You can check the “show regions of elasticity” box in the diagram above to see which part of the demand curve is perfectly elastic, elastic, unit elastic, inelastic, and perfectly inelastic. You might notice that, regardless how you move the intercepts of the demand curve:

the demand elasticity (in absolute value) increases as $P$ increases. That is, as price increases and quantity decreases, even though a €1 increase in price always leads to the same decrease in quantity, that same €1 increase in price represents a smaller and smaller percent of the price, while the quantity decrease represents a larger and larger percent decrease in quantity.

in the extreme case when $Q = 0$ (along the vertical axis), demand is perfectly elastic ($\epsilon = \infty$). This is because even the smallest decrease in price will result in an infinite percentage change in quantity (from zero to some positive number).

in the other extreme case when $P = 0$ (along the horizontal axis), demand is perfectly inelastic ($\epsilon = 0$). This is because it would take an infinite percentage change in price (from zero to some positive number) to cause any change in quantity.

demand is unit elastic at the midpoint of the demand curve. This is because, if demand is given by $Q = a  bP$, then the demand curve extends from $(a, 0)$ to $(0, \frac{a}{b})$, and the formula for elasticity is \(\epsilon_{Q,P} = \frac{bP}{abP}\) This is equal to $1$ when $bP = a  bP$, which occurs at the the point $(\frac{a}{2}, \frac{a}{2b})$ – i.e., the midpoint of the demand curve.
Putting this all together, we can see that the upper (i.e., left) half of the demand curve is elastic, and the lower (i.e. right) half of the demand curve is inelastic.
Evaluating elasticity using calculus
If we take the limit as the change in the exogenous variable $\Delta x$ gets arbitrarily small, we can write this in the standard calculus way: \(\lim_{\Delta X \rightarrow 0} \epsilon_{Y,X} = \frac{dy}{dx} \times \frac{x}{y}\) If we know the formula for the relationship between the exogenous variable $X$ and the endogenous variable $Y$ – that is, if $y = f(x)$ – then we can write the instantaneous elasticity as a function of $x$ as \(\epsilon(x) = f^\prime (x) \times \frac{x}{f(x)}\) Note that this is all written as a function of the exogenous variable $X$: for example, if we were to think of the price elasticity of demand, we would ask what the elasticity is at a certain price $P$ (the exogenous variable), not at a certain quantity $Q$ (the endogenous variable).
Example: A demand curve with constant elasticity
Consider the demand curve described by the function $Q(P) = 3600P^{2}$. Then the price elasticity of demand is \(\epsilon_{Q,P} = \frac{dQ}{dP} \times \frac{P}{Q(P)} = 7200P^{3} \times \frac{P}{3600P^{2}} = 2\) That is, at every point along the demand curve, the (instantaneous) elasticity is 2:
In fact, you can easily check to see that any function of the form $f(x) = ax^b$ has an elasticity of simply $b$! See this page for a more thorough exploration of this special case.