I am required to show that if $$f\left(\frac{a+b}{2}\right)=\frac{f(a)}{2}+\frac{f(b)}{2}, \forall a,b\in\mathbb{R},$$ then $$f\left(\frac{a_1+a_2+\cdots+a_n}{n}\right)=\frac{f(a_1)}{n}+\frac{f(a_2)}{n}+\cdots+\frac{f(a_n)}{n}, \forall a_i\in\mathbb{R}$$
I tried to use PMI, but I could not get anywhere.
You can do it by Jensen's functional equation.
If $f(\frac{a+b}{2})=\frac{f(a)}{2}+\frac{f(b)}{2}, \forall \space a,b\in\mathbb{R}$,
then it is required that $f(x)$ is linear, given some other conditions. (It is reducible to Cauchy's functional equation, which has a linear solution with no constant term, given some other conditions, e.g: If $f$ is continuous at atleast one point, the possiblities of all monstrous solutions are eliminated).
Once you get a linear solution, i.e, $f(x) = cx+d \space$ for some $c,d\in\mathbb{R}$, the next result will follow easily.
P.S: This will only be true if there are some conditions on $f$ which allow Cauchy's functional equation to have a linear solution passing through origin. Refer this link.