We use the potential theory to give integral representations of functions in the Sobolev spaces W1,p(Ω), where p≥1 and Ω is a smooth bounded domain in ℝN (N≥2). As a byproduct, we obtain sharp inequalities of Ostrowski type.