Where do the rich and poor live in a city? (Calculus)
1. The first question is based on a misreading of the text.
First of all it is quite correct that under the model assumptions stated:
$$(A) \ \ p''(d) = \frac{t(y)H'(y) - t'(y)H(y)}{H(y)^2} y'(d),$$
however there is no problem because the book does not state that
$$(B)\ \ p''(d) = \frac{t(y)H'(y) - t'(y)H(y)}{y'(d)}$$
the book instead states that the second order condition
$$ p''(d) &gt; 0 $$ implies $$(C)\ \ \  \frac{t(y)H'(y) - t'(y)H(y)}{y'(d)} &gt; 0$$
which follows from (A) - the true experssion you have derived for $p''(d)$ - by multiplication of $(H(y))^2$ and division of $(y'(d))^2$.
Nevertheless, I suspect it is a typo even though it is inconsequential.
Obviously, given (C) or [(A) and the second order condition $p''(d)&gt;0$] it follows that $y'(d)&gt;0$ iff
$$t(y)H'(y) - t'(y)H(y) &gt; 0,$$
which again is equivalent to $$\frac{y}{H(y)} H'(y) &gt; \frac{y}{t(y)} t'(y)$$
hence the high income people live in the suburbs ( $y'(d)&gt;0$ income increases in distance from city center) iff and only if the income elasticity of housing is larger than the income elasticity of transport costs $t(y)$.

The second question: How can income be a function of distance $y=y(d)$ when we differentiate the second order condition but not when we consider the first order condition?

The idea is as usual that residents have some income $y$ exogenously given. They cannot decide themselves what income the want nor is their income a product of their location choice. When they choose an optimal location $d^\star$ they choose in such a manner that the first order condition $p'(d) = - t(y)/H(y)$ must hold. However, individuals of different income levels will choose different locations and therefore in equilibrium income will be a function of location $y = y(d)$. Therefore when you want to consider what things are like in equilibrium you can use that income $y$ is a function of $d$.
Glaeser does not proove the existence of such an equilibrium but this type of equilibria with perfect income sorting is known in the literature and the book is a textbook.
The derivation of the first order condition in this simplified model where housing demand is assumed exogenously given as a function of income goes along these lines:
The residents have utility function $U(c,H)$ and income $y - t(y)d$ net transport. They maximize with respect to $c$ so conditonal on $d$ the value function is $U(y - t(y)d - p(d)H(y),H(y))$. In spatial eq. if people with the income $y$ is in the city then they choose some $d^\star$ maximizing the conditional indirect utility function $U(y - t(y)d - p(d)H(y),H(y))$ with respect to $d$ giving the utility $U(y - t(y)d^\star - p(d^\star)H(y),H(y)) = u^\star(y)$. These individuals would only ever consider other locations if they gave the same level of utility (or higher but in that case $u^\star(w)$ would not be maximum). This allows the us to undertake the thought experiment: How would prices have to change as a function of location if other locations gives rise to the same level of utility? This thought experiment is carried out by imposing the condition that $U(y - t(y)d - pH(y),H(y)) = u^\star(y)$ at all locations and solving for the price (giving what is called the bid-function). The derivative of the implied bid-function can be found by differentiating $U(y - t(y)d - pH(y),H(y)) = u^\star(y)$ with respect to $d$ giving the condition $p'(d)H(y) = - t(y)$ which is the wellknown Muth condition.