Various sharp pointwise estimates for the gradient of solutions to the heat equation are obtained. The Dirichlet and Neumann conditions are prescribed on the boundary of a half-space. All data belong to the Lebesgue space L p . Derivation of the coefficients is based on solving certain optimization problems with respect to a vector parameter inside of an integral over the unit sphere.