For $k\ge0$ and integer
Given this function $f(k)=\frac{1}{2}(3^k-1)$
Which is equal to this recurrence relation $f(k)=3f(k-1)+1$
It follows that $f(k-1)=\frac{f(k)-1}{3}$
But I am also told that $f(k-1)=\left\lfloor\frac{f(k)}{3}\right\rfloor$
I am not sure how the last equality is true.
Since $f(0)$ is an integer, then from the recursion, it's clear that $f(k)$ is an integer, for all $k \ge 0$.
Let $k \ge 1$.
Then since $f(k-1)={\large{\frac{f(k)-1}{3}}}$, it follows that ${\large{\frac{f(k)-1}{3}}}$ is an integer, hence ${\large{\frac{f(k)}{3}}}$ is ${\large{\frac{1}{3}}}$ more than the same integer.
Taking the floor removes the extra $\frac{1}{3}$, hence $$\left\lfloor{{\small{\frac{f(k}{3}}}}\right\rfloor={\small{\frac{f(k)-1}{3}}}=f(k-1)$$