For a component in an ideal or dilute ideal solution, the chemical potential is given by: $$\mu_{i}^{id}=\mu_{i}^{0}+RTlnx_i$$ Solving for $x_i$

$$x_i=e^{[(\mu_i-\mu_{i}^{0})/RT]}$$

We define the activity of component i in a real solution as:

$$a_i=e^{[(\mu_i-\mu_{i}^{0})/RT]}$$ Activity plays the same role in real solutions as mole fraction in ideal ones.

Therefore, the chemical potential of a component in any solution (ideal or real) is given by:

$$\mu_{i}=\mu_{i}^{0}+RTlna_i$$

The coefficient of activity, $\gamma_i$, measures the degree of divergence of the behavior of substance i with respect to the ideal behavior. $$\mu_i-\mu_{i}^{id}=\mu_{i}^{0}+RTlna_i-(\mu_{i}^{0}+RTlnx_i)=RTln\frac{a_i} {x_i}$$

Where, $\gamma_{i}=\frac{a_i}{x_i}$, the activity coefficient. Clearing the activity, $a_i=x_i\gamma_i$.

$$\mu_{i}=\mu_{i}^{0}+RTlnx_i\gamma_i$$

Both the activity and the activity coefficient depend on the same variables as the chemical potential $\mu_i$

$$a_i=a_i(T,P,x_1,x_2,......)\;\;\Rightarrow \;\; \gamma_i=\gamma_i(T,P,x_1,x_2........)$$