4. The function $f(x)$ satisfies $5 f(\arctan x)+3 f(-\arctan x)=\operatorname{arccot} x-\frac{\pi}{2}, f(x)=$
4. $f(x)=-\frac{x}{2}$.

Given the condition, substituting $\cos -x$ for $x$ yields $5 f(\arctan (-x))+3 f(-\arctan (-x))=\arctan (-x)-\frac{\pi}{2}$, which simplifies to $3 f(\arctan x)+5 f(-\arctan x)=\frac{\pi}{2}-\operatorname{arccot} x$. Also, $5 f(\arctan x)+3 f(-\arctan x)=\operatorname{arccot} x-\frac{\pi}{2}$. Therefore, $8(f(\arctan x)+f(-\arctan x))=0$, and $f(-\arctan x)=-f(\arctan x)$, indicating that $f(x)$ is an odd function. From the original condition, we can derive $2 f(\arctan x)=\operatorname{arccot} x-\frac{\pi}{2}$, and $2 f(\arctan x)=-\arctan x$, leading to $f(\arctan x)=-\frac{1}{2} \arctan x$. Thus, $f(x)=-\frac{x}{2}$.