Edit: According to the comment by LSpice we come back to the initial version of this question


Let $f:\mathbb{R}^n\to \mathbb{R}^n$ be a smooth function such that for every $x\in \mathbb{R}^n$ the derivative $A=Df(x)$ satisfies the condition $a\_{ii}=1$ and $a\_{ij}=k(x),\; \forall i\neq j$ where $k(x)$ depends only on $x$. Does it imply that $f $ is a linear map?


A some what similar form of this linear part is considered here


<https://qr.ae/pNsOY1>



Is it a sufficient condition for linearity?
I answer the version where you assume that the diagonal entries of $Df$ are constant (all $1$, in your problem), and the off-diagonal entries of each $Df(x)$ are all the same value $k(x)$.


I assume that, by linear, you mean affine linear. Then this is clear if $n = 1$. Otherwise, fix $i$, let $f\_i$ be the appropriate component function of $f$, and choose any $j \ne i$. Since $k$ equals $\frac\partial{\partial x\_j}f\_i$ and $\frac\partial{\partial x\_i}f\_i$ equals $1$, we have that $\frac\partial{\partial x\_i}k = \frac\partial{\partial x\_j}1 = 0$. That is, $k$ is constant, so $Df$ is constant, so $f$ is affine linear.


