Problem: The average salary of male employees in a firm was Rs $520$ and that of a female was Rs $420$. The mean salary of all employees was Rs. $500$. Find the percentage of male and female employees.
Solution: Let $n_m$, $n_f$ denote the number of male and female employees in the firm respectively. Further assume that
\begin{align*}
x_m & = \text{ the average salary of male employees } \\
x_f & = \text{ the average salary of female employees } \\
x & = \text{ average salary of all the employees } .
\end{align*}
According to the problem,
\begin{align*}
x_m = 520 \quad x_w = 420 \quad \text{ and } \quad x = 500.
\end{align*}
We have
\begin{align*}
x = \frac{n_m x_m + n_f x_f}{n_m + n_f} & \implies 500 = \frac{520 n_m + 420 n_f}{n_m + n_f}\\
& \implies 500(n_m + n_f) = 520 n_m + 420 n_f\\
& \implies 20 n_m - 80 n_f = 0 \\
& \implies \frac{n_m}{n_f} = \frac{4}{1}.
\end{align*}
Therefore, the percentage of male employees in the firm will be
\[
\frac{4}{4 + 1} \times 100 = 80\%
\]
and the percentage of male employees in the firm will be
\[
\frac{1}{4 + 1} \times 100 = 20\%.
\]