We are interested in variational problems involving weights that are singular at a point of the boundary of the domain. More precisely, we study a linear variational problem related to the Poincaré inequality and to the Hardy inequality for maps in H01(Ω), where Ω is a bounded domain in ℝN, N ≥ 2, with 0 ∈ ∂Ω. In particular, we give sufficient and necessary conditions so that the best constant is achieved.