Quadratic diameter of a metric space and its application to a problem in analysis