Let \( \mathcal {G} \) be a generalized matrix algebra over a commutative ring. We prove that, under some mild conditions, if \( \varphi : \mathcal {G} \rightarrow \mathcal {G} \) is a linear map satisfying \( \varphi (p_n(x_1, x_2, ... ,x_n))=\sum _{i=1}^n p_n(x_1,..., x_{i-1},\varphi (x_i), x_{i+1},...,x_n) \) for any \( x_1, x_2,...,x_n \in \mathcal {G} \) with \( x_1x_2=e\) , where e is an arbitrary fixed point in \(\mathcal {G}\) , then \(\varphi =\delta +\gamma \) , where \(\delta \) is a derivation on \( \mathcal {G} \) and \( \gamma : \mathcal {G} \rightarrow \mathcal {Z}(\mathcal {G}) \) is a linear map vanishing on \(p_n(x_1, x_2,...,x_n)\) with \(x_1x_2=e\) . In addition, this result is applied to full matrix algebras, triangular algebras and nest algebras.