$\underline {Background}$: Suppose $X$ is a scheme and $\mathcal F$ is a sheaf of $\mathcal O_X$ module.
Suppose we have, $\mathcal {F}\oplus \mathcal {O}_X \cong \oplus_r \mathcal {O}_X$ as sheaves of $\mathcal O_X$ modules.
$\underline {Question}$: Can we say that $\mathcal {F} \cong \oplus_{r-1} \mathcal {O}_X$ ?
$\underline {Attempt}$:I tried to define map on all {$SpecA$} which in turn will define a morphism as follows,
If we denote the isomorphism $\mathcal {F}\oplus \mathcal {O}_X \cong \oplus_r \mathcal {O}_X$ as $\phi$
then I define $T(specA):\mathcal F(specA)\to \oplus_{r-1}\mathcal O(specA)$ as
$T(specA)(a):=\phi(SpecA)(a,0)$ with the last coordinate omitted
But,I cannot see why this should be injective and surjective?
Any help from anyone is welcome
In the case that $r=2$ the answer is yes. The affine case is discussed at this question: $M\oplus A \cong A\oplus A$ implies $M\cong A$?, and the proof works just as well for all schemes.
If $r \geq 3$ the answer is no. It is enough to consider affine schemes. So we have a ring $R$ and an isomorphism of modules $M \oplus R \cong R^{\oplus r}$, the question is whether $M$ is free of rank $r-1$.
You should be aware of the following definition:
This is a little more general than what you are asking (the extra parameter $n$) but given any stable free module as above then, $M = P\oplus R^{\oplus n-1}$ will be a counterexample to your question. (Note: your $M$ is necessarily a projective module, so locally it is isomorphic to $R^{\oplus r-1}$.)
Examples of stably-free modules which are not free are a little hard to come by, but for instance Keith Conrad has a note with an example over the real coordinate ring of the 2-sphere. For more examples see papers of Swan and of Kumar et al. There is some discussion about this at this question on overflow as well. It mentions the Bass Cancellation theorem, which says that for large enough rank (compared to the Krull dimension of the ring) stably free modules actually are free.