A fire station is to be located along a road of length A

(a) A fire station is to be located along a road of length A, A< ∞. If fires occur at points uniformly chosen on (0, A), where should the station be located so as to minimize the expected distance from the fire?
That is, choose a so as to minimize E[|X−a|] when X is uniformly distributed over (0, A).
(b) Now suppose that the road is of infinite length—stretching from point 0 outward to ∞ If the distance of a fire from point 0 is exponentially distributed with rate λ, where should the fire station now be located?
That is, we want to minimize E[|X-a|], where X is now exponential with rate λ.