In this paper we propose a new formalism to map history-dependent metadynamics in a Markovian process. We apply this formalism to a model Langevin dynamics and determine the equilibrium distribution of a collection of simulations. We demonstrate that the reconstructed free energy is an unbiased estimate of the underlying free energy and analytically derive an expression for the error. The present results can be applied to other history-dependent stochastic processes such as Wang-Landau sampling.In recent years increasing attention has been paid to the possibility of studying equilibrium thermodynamical processes by means of non-equilibrium processes [1,2,3,4,5]. A major breakthrough in this field is the work of Jarzynski [2] who has demonstrated that it is possible to estimate the free energy difference between two states as a suitable average of the work done on the system by forcing the transition in a finite time.More recently, two of us have introduced, on a more empirical basis, the metadynamics method [6] in which the free energy as a function of one or more collective variables (CVs) is obtained from a non-equilibrium simulation. In this method, the dynamics of a system at finite temperature is biased by a history-dependent potential constructed as the sum of Gaussians centered on the trajectory of the CVs. After a transient period, the free energy dependence on the CVs can be estimated as the negative of the bias potential. This method is closely related to the local elevation method [7], to coarse molecular dynamics [8,9] and to the adaptive-force bias method [10]. Moreover, as described in Ref.[11], metadynamics can be viewed as a finite temperature extension of the Wang-Landau approach [12], where the density of states of a system is estimated by a Monte Carlo procedure in which the acceptance probability of a move is modified every time a configuration is explored. The practical validity of the metadynamics method has been demonstrated in a number of applications to real problems [6,11,13,14,15,16,17,18,19,20], and an empirical way to evaluate the error has been suggested in Ref. [21]. Attempts at a more formal approach have so far been frustrated by the lack of a formalism capable of handling a non-Markovian process [22].The problem of working with history-dependent dynamics is that the forces (or the transition probabilities) on the system depend explicitly on its history. Hence it is not a priori clear if, and in which sense, the system can reach a stationary state under the action of these dynamics. In this Letter we introduce a formalism that allows us to demonstrate that this is indeed the case, at least when the evolution of the system is of the Langevin type. We introduce a novel mapping of the history-dependent evolution into a Markovian process in the original variable and in an auxiliary field that keeps track of the configurations visited. Using this mapping we are able to validate rigorously the metadynamics method. In particular, we show that the average over several independent simulat...