I was checking some questions I recently answered here on General Equilibrium, and a result from this one (Exchange economy with two agents, what's the competitive equilibrium?) drew my attention:
Both agents $i = A,B$ have the following utility function:
$U_i(x_i,y_i) = - e^{-x_i} - e^{-y_i}$
and the endowments are $((w_{x_A},w_{y_A}), (w_{x_B},w_{y_B})) = ((1,5),(3,3))$.
For this problem I got the following demands for good $x$
${x_A}^\star = \frac{p_x - \ln(p_x) + 5}{p_x + 1}$
${x_B}^\star = \frac{3 p_x - \ln(p_x) + 3}{p_x + 1}$
Note I took good $p_y = 1$ as numeraire, so the demands for good $x$ are functions of its own price.
Adding them both up, I get the following "aggregate demand function" for good $x$
$x^\star = \frac{4 p_x - 2 \ln(p_x) + 8}{p_x + 1}$
I plotted this function on Geogebra and it seemed to be decreasing up to a certain price, from which, it would become increasing in its own price, analogous to a Giffen good.
I then proceded to take its derivative to check what the graph showed. I got the following expression, which I'd then $\overset{set}{=} 0$ to find extrema:
$\frac{dx^\star}{dp_x} = \frac{2p_x \ln(p_x) - 6p_x - 2}{p_x (p_x + 1)^2} \overset{set}{=} 0$
GeoGebra and WolframAlpha yield a numerical solution near $p_x = 21.06$
Here I show graphs of both the aggregate $x$-demand function and its derivative, respectively:
Note: My Geogebra is in Spanish, the words "extremo" and "raíz" mean "extremum" and "root", respectively.
If there is an upward sloping portion of the aggregate demand function, in particular, at least one agent has a demand function with an upward sloping portion.
The fact that Walrasian demands with upward sloping portions are mathematically possible made me think about the following question:
Can we talk about Giffen goods in pure exchange economies (the usual Edgeworth box)? If so, then there must be a way to define income and substitution effects, and an interpretation of the Giffen good scenario.