In chemical thermodynamics, the reaction quotient (Q or just Q) is a dimensionless quantity that provides a measurement of the relative amounts of products and reactants present in a reaction mixture for a reaction with well-defined overall stoichiometry at a particular point in time.  Mathematically, it is defined as the ratio of the activities (or molar concentrations) of the product species over those of the reactant species involved in the chemical reaction, taking stoichiometric coefficients of the reaction into account as exponents of the concentrations. In equilibrium, the reaction quotient is constant over time and is equal to the equilibrium constant.
A general chemical reaction in which α moles of a reactant A and β moles of a reactant B react to give ρ moles of a product R and σ moles of a product S can be written as 
The reaction is written as an equilibrium even though, in many cases, it may appear that all of the reactants on one side have been converted to the other side. When any initial mixture of A, B, R, and S is made, and the reaction is allowed to proceed (either in the forward or reverse direction), the reaction quotient Q, as a function of time t, is defined as
where {X} denotes the instantaneous activity of a species X at time t. 
A compact general definition is
where П denotes the product across all j-indexed variables, a(t) is the activity of species j at time t, and ν is the stoichiometric number (the stoichiometric coefficient multiplied by +1 for products and –1 for starting materials).