The inverse problem of determining the temperature of a heat conductor together with an unknown spacewise dependent heat source from measured final data or time-average temperature observation is studied. The weak solution theory is applied for calculating the gradient of the least-squares functional that is minimized. For the general case when the heat. source is the product between a known function h(x, t) and the unknown source function f(x) new explicit formulae, derived via the solution of the corresponding adjoint problem, are obtained. Numerical results obtained using the conjugate gradient method are presented and discussed. (C) 2013 Elsevier Inc. All rights reserved.