Consider the classical Sobolev trace inequality ‖ ∇ φ ‖ L 2 ( R + n ) ≥ K ‖ φ ‖ L 2 ( n − 1 ) n − 2 ( ∂ R + n ) \begin{equation*} \|\nabla \varphi \|_{L^2(\mathbb {R}^n_+)} \geq K\|\varphi \|_{L^{\frac {2(n-1)}{n-2}}(\partial \mathbb {R}^n_+)} \end{equation*} for all φ ∈ W 0 1 , 2 ( R + n ) \varphi \in W^{1,2}_0(\mathbb {R}^n_+) , where K K is the best constant. Here, W 0 1 , 2 ( R + n ) W^{1,2}_0(\mathbb {R}^n_+) is the space obtained by taking the completion in the norm ‖ ∇ φ ‖ L 2 ( R + n ) \|\nabla \varphi \|_{L^2(\mathbb {R}^n_+)} of the set of all smooth functions with support contained in the closure of R + n \mathbb {R}^n_+ , and n ≥ 3 n\geq 3 . Let M \mathcal {M} be the set of functions for which we have equality in the Sobolev trace inequality above. In this note, we show that there is a positive constant α \alpha such that ‖ ∇ φ ‖ L 2 ( R + n ) 2 − K 2 ‖ φ ‖ L 2 ( n − 1 ) n − 2 ( ∂ R + n ) 2 ≥ α d ( φ , M ) 2 \begin{equation*} \|\nabla \varphi \|_{L^2(\mathbb {R}^n_+)}^2-K^2 \|\varphi \|_{L^{\frac {2(n-1)}{n-2}}(\partial \mathbb {R}^n_+)}^2\geq \alpha d(\varphi ,\mathcal {M})^2 \end{equation*} for all φ ∈ W 0 1 , 2 ( R + n ) \varphi \in W^{1,2}_0(\mathbb {R}^n_+) , where d d is the distance in the Sobolev space W 0 1 , 2 ( R + n ) W^{1,2}_0(\mathbb {R}^n_+) .