# How to find a generalized inverse of a vector in sagemath?

Given a vector $u$ of size $n\times 1 $. How to find the g-inverse of $u$?

Is there any specific command like

u.ginv()

to find the ginverse or we have define it?? If so, how to do that?

Any hint will help me lot.

## Defn:

for a vector $u_{n\times 1} $ a vector $v_{1\times n}$ is said to be generalized inverse of $u$ if $$uvu=u.$$