Q: Horizontal product differentiation problem It's a version of the Hotelling model (product differentiation).
One firm is located at the beginning of a line between 0 to 3, one at the end of the line (so one at 0, one at 3). There are $b/2$ consumers at 0, and $b/2$ at 3. Over the interval [1,2] there are $1-b$. Linear transport costs = λ per unit of distance travelled.
Utility for consumer from buying from firm 1 is $U(x_1) = v - λx - p_1$ (change x for 1-x for firm 2). The indifference condition is $U(x_1)=U(x_2)$. What are the demand functions for each firm?
My answer: $D_1(p_1,p_2) = 1/2 + (p_2-p_1)/2λ + (b/2)*p_1$
Is this correct? I don't know how to factor in the fact that there are $b/2$ consumers at either end.

A: No the above is not entirely correct. Hint: depending on $v$, $\lambda$ if the price differential is to too big or too small one firm may capture the entire market. What has to be $p_1-p_2$ so that all consumers at zero buy from the firm located at one? Your demand may be discontinuous (only piecewise continuous).
Edit (too large for comment):
I think in the question change x for 1-x for firm 2 is wrong, it should be change x for 3-x for firm 2 because firm 2 is at 3.
If a consumer at zero buys from 1 her utility is: $v-p_1$. If a consumer at zero buys from 2 her utility is $v-3\lambda-p_2$. So she is indifferent if $p_1-p_2=3\lambda$.
So the demand of firm 1 is (there is one case for you to complete): $$D_1(p_1,p_2)=\begin{cases} 
0 &\text{ if } \quad p_1-p_2>3\lambda\\
\dfrac{b}{2} & \text{ if } \quad\lambda <p_1-p_2<3\lambda\\
\text{ ... } & \text{ if } \quad-\lambda<p_1-p_2<\lambda\\
1 &\text{ if } \quad p_1-p_2<-3\lambda\end{cases}$$
