Task 3. (15 points) The function $f(x)$ satisfies the condition: for any real numbers $a$ and $b$, the equality $f\left(\frac{a+2 b}{3}\right)=\frac{f(a)+2 f(b)}{3}$ holds. Find the value of the function $f(2022)$, if $f(1)=1, f(4)=7$.

#
# Solution.

Substituting the pairs of numbers \(a=4, b=1\) and \(a=1, b=4\) into the given equation, respectively, we get

If \(a=4, b=1\), then \(f\left(\frac{4+2}{3}\right)=\frac{f(4)+2 f(1)}{3}, f(2)=\frac{7+2 \cdot 1}{3}=3, f(2)=3\).

If \(a=1, b=4\), then \(f\left(\frac{1+2 \cdot 4}{3}\right)=\frac{f(1)+2 f(4)}{3}, f(3)=\frac{1+2 \cdot 7}{3}=5, f(3)=5\).

If we take \(a=0, b=3\), we get \(f\left(\frac{0+2 \cdot 3}{3}\right)=\frac{f(0)+2 f(3)}{3}, f(2)=\frac{f(0)+2 f(3)}{3}\).

Thus, \(f(0)=3 f(2)-2 f(3), f(0)=3 \cdot 3-2 \cdot 5, f(0)=-1\).

Therefore, we have \(f(0)=-1, f(1)=1, f(2)=3, f(3)=5, f(4)=7\).

Let's form a chain of equalities

\[
\begin{aligned}
& f\left(\frac{2022+2 \cdot 0}{3}\right)=\frac{f(2022)+2 f(0)}{3}=f(674) \\
& f\left(\frac{674+2 \cdot 2}{3}\right)=\frac{f(674)+2 f(2)}{3}=f(226) \\
& f\left(\frac{226+2 \cdot 1}{3}\right)=\frac{f(226)+2 f(1)}{3}=f(76) \\
& f\left(\frac{76+2 \cdot 1}{3}\right)=\frac{f(76)+2 f(1)}{3}=f(26) \\
& f\left(\frac{26+2 \cdot 2}{3}\right)=\frac{f(26)+2 f(2)}{3}=f(10) \\
& f\left(\frac{10+2 \cdot 1}{3}\right)=\frac{f(10)+2 f(1)}{3}=f(4)
\end{aligned}
\]

Calculating in reverse order, we get:

\[
\begin{aligned}
& f(10)=3 f(4)-2 f(1) \text {, i.e., } f(10)=3 \cdot 7-2 \cdot 1=19 \\
& f(26)=3 f(10)-2 f(2) \text {, i.e., } f(26)=3 \cdot 19-2 \cdot 3=51 \\
& f(76)=3 f(26)-2 f(1) \text {, i.e., } f(76)=3 \cdot 51-2 \cdot 1=151 \\
& f(226)=3 f(76)-2 f(1) \text {, i.e., } f(226)=3 \cdot 151-2 \cdot 1=451 \\
& f(674)=3 f(226)-2 f(2) \text {, i.e., } f(674)=3 \cdot 451-2 \cdot 3=1347 \\
& f(2022)=3 f(674)-2 f(0) \text {, i.e., } f(2022)=3 \cdot 1347-2 \cdot(-1)=4043
\end{aligned}
\]

Answer. 4043.