$p$ is irreducible if and only if the only divisors of $p$ are the associates of $p$ and the unit elements of $R$
Let $R$ be an integral domain and $p ∈ R$ be such that $p$ is nonzero and a nonunit. Then $p$ is irreducible if and only if the only divisors of $p$ are the associates of $p$ and the unit elements of $R$.
Proof. Suppose the only divisors of p are the associates of $p$ and the unit elements of $R$. Let $p = ab$ for some $a, b ∈ R$. Suppose $a$ is not a unit. Then $a$ is an associate of $p$. Therefore, $a = pu$ for some unit $u ∈ R$. Now $p = pub$. Since $R$ is an integral domain, it follows that $ub = 1$. Hence, $b$ is a unit and so $p$ is irreducible. We leave the converse as an exercise.
this is a theorem from a book and I have tried to proof the converse in the following way:-
suppose $p$ is irreducible and $a|p$. Then there exist $b\in R$ such that $p=ab$ . Since $p$ is irreducible so one of $a$ & $b$ is unit.Let $a$ is unit.Then we need to show that $b$ is associate of $p$. Since $a$ is unit there exist $u \in R$ such that $au=1$. hence $aup=p \implies aup=ab \implies up=b $.So the result follows.
Am I correct?
Yes. The key idea is this: $ $ a factor $\,b\,$ of $\,\color{#c00}{p = ab}\,$ is a unit $\iff$ its cofactor $\,a\,$ is associate to $\,p,\,$ by
$$\,b\ \ {\rm unit} \iff {\overbrace{b\mid 1 \iff\!\!\ p\mid a}^{\Large\color{#c00}{ 1/b\ \ \ \ =\ \ \ \ a/p}}}\!\overset{\color{#c00}{\large a\,\mid\, p}}\iff a\ \ {\rm associate\ to}\ \ p\qquad\ $$