Say you have a bimodule $M$ over a ring $A$ with maps $f,g:M \rightarrow A^n$ such that $f$ is injective and $g$ is surjective. Can we say that $M \cong A^n$? What if $f$ and $g$ were in the opposite direction? What if $A$ is commutative?
I figured out that if the free module is infinite dimensional, then they need not be isomorphic, but can't figure out the finite dimensional case.
EDIT: I would welcome an answer even if it just answers the commutative case.