Q: Let R be a commutative ring with unity. Prove that if A is an ideal of R and A contains a unit, then A=R.
This is my attempt at an answer: It suffices to show that all the elements in R are in A.
Let a be and element of A, and r be an element of R. Since A is an ideal of R then all elements ar and ra must be in A.
We know that A has a unit say 1, then we know 1r and r1 for all r in R, are in A.
Thus all elements in R are in A, therefore A=R.
The idea is correct. But, the details are lacking.
You know that $A$ contains a unit (not the unit element $1_R$).
Recall that a unit is an element $u$ that has a multiplicative inverse, that is there exists a $v$ such that $uv =1_R$.
So, you have such an element $u$. It might be $1_R$ itself, but it does not have to be. And if it is not there is a small step missing.