Comparative statics
Generally, a comparative statistics exercise consists in observing how the solution to a problem changes in response to a change in some of its data.
The demand curve links the price to the amount that consumers demand of that good, but there may be other variables that also influence consumer's decisions. For example, think of a good $x$ for which there is a close substitute good. The demand for good $x$ depends on its price but also the other good's price. So we have that \[x_d=x_d(p_x,p_y)\]
How will $x_d$ depend on $p_x$? Sol.
We can express it using the partial derivatives \[ \frac{\partial x_d(p_x, p_y)}{\partial p_x} < 0 \] which means that the greater the $p_x$, the lower the demand for good $x$.
And by being substitutes \[ \frac{\partial x_d(p_x, p_y)}{\partial p_x} > 0 \] the greater the $p_y$, the greater the demand for good $x$.
We pose the following comparative statics question: How will a rise in $p_y$ affect the equilibrium price of good $x$?
If you had a specific case, you could calculate the initial and final equilibrium and compare them. But before looking at an example, let's see what happens graphically.
The initial demand curve corresponds to an initial price of the substitute good, $p_y^o$. What happens if this $p_y$ varies?
The figure allows you to propose a specific variation of $p_y$. A positive value, $\Delta p_y>0$, means a price increase (if, $\Delta p_y<0$ we are looking at a decrease).
 Before moving $\Delta p_y$, can you anticipate what will happen to the demand curve in the figure? Sol.
Remember that $x$ and $y$ are substitutes for each other. An increase in $p_y$ will increase the demand for the good $x$ at any price $p_x$. Thus, a new demand curve emerges further to the right than the initial one.Use the slider and check.
 Will the rise of $p_y$ affect the market equilibrium of the good $x$? How? Sol.
The new equilibrium, $(x',p')$, will be the point where the new demand curve and the supply curve The supply curve remains the same. intersect
 How does the $p_y$ increase affect the equilibrium price of the good $x$? and how does it affect the amount exchanged? Sol.
The new equilibrium price is higher than the initial one. Even so, the expansion of demand causes an increase in the amount exchanged (the rise in the amount is not as high as it would have been if the price of the good $x$ had remained the same, but still increases).
 The above answer is based on what the figure shows, can you make an economic reading of what happens? Sol.
As $p_y$ rises, the demand for the $x$ good increases at any $p_x$. But companies are already offering everything they want to sell at that price, so there would be an excess demand that would push up the price. This rise means that companies are willing to sell more at the same time as consumers no longer want to buy so much. The process stops when the new market equilibrium is reached at $(x',p')$.
Example

What is the initial market equilibrium for the $x$ good? Sol.
Matching supply and demand (and using $p_y=20$)\[80+202 p_x=p_x8 \Longrightarrow p_x^*=36 \;\mathrm{ ,}\;\;x^*=28\]
 What would be the equilibrium if $p_y$ rises up to $p_y'=32$? Sol.
We repeat the calculation for the new $p_y$ \[80+322 p_x=p_x8 \Longrightarrow p_x'=\frac{120}{3}=40 \;\mathrm{ ,}\;\;x'=28\]
 What was the impact of the $p_y$ increase? Sol.
By comparing the initial and final equilibria we have that an increase $\Delta p_y=12$ causes the following variations in the equilibrium \[\Delta p_x=4036=4 \quad \textrm{and}\quad \Delta x=3228=4\]
A bit of calculation allows us to obtain a general expression for the impact of the $p_y$ change on the equilibrium $p_x$. We have a supply of $x$ that depends on $p_x$ and a demand that depends on $p_x$ and also on $p_y$. The equilibrium equation will be
\[x_d(p_x,p_y)=x_s(p_x)\] By clearing $p_x$ in this equation, we obtain an expression in which the price of equilibrium, $p_x^*$, depends on $p_y$ \[x_d(p_x(p_y),p_y)=x_s(p_x(p_y))\]Deriving the expression with respect to $p_y$ we have
\[\frac{\partial x_d(\cdot)}{\partial p_x}\frac{\mathrm{d}p_x(\cdot)}{\mathrm{d}p_y}+\frac{\partial x_d(\cdot)}{\partial p_y}=\frac{\mathrm{d}x_s(\cdot)}{\mathrm{d}p_x}\frac{\mathrm{d} p_x(\cdot)}{\mathrm{d}p_y}\] and rearranging \[\frac{\mathrm{d}p_x(\cdot)}{\mathrm{d}p_y}\left(\frac{\mathrm{d} x_s(\cdot)}{\mathrm{d} p_x}\frac{\partial x_d(\cdot)}{\partial p_x}\right)=\frac{\partial x_d(\cdot)}{\partial p_y}\] Finally, \[\frac{\mathrm{d}p_x(\cdot)}{\mathrm{d}p_y}=\frac{\frac{\partial x_d(\cdot)}{\partial p_y}}{\left(\frac{\mathrm{d} x_s(\cdot)}{\mathrm{d} p_x}\frac{\partial x_d(\cdot)}{\partial p_x}\right)}\] The effect of a change in $p_y$ on the equilibrium price of the $x$ good is determined by the $x_d$ derivative with respect to the $p_y$ (which would be the horizontal shift in $x$'s demand per unit of rise in $p_y$) and the difference between the derivatives in $p_x$ of supply and demand (which are the inverse of the slopes).