Do you need to read a whole article before citing it? During writing my academic paper, I need to cite a definition in a scientific paper. The other part of the paper, is irrelevant to my work. 

I have been advised that if you will cite a paper, you need to read that paper entirely. But in this case, it seems useless to do so. 

It also happened a few times when I wanted to cite from some books.
No, you don't have to read the whole paper.
If you think you do, ask yourself this:


  do you also have to read all papers cited in the paper?


For example, I recently needed to know a certain function of n. Some computer experimentation suggested that it might be 3*2^n, let's say. Then I found a paper published in a reputable journal that claimed to prove exactly that. As the reasons why it was 3*2^n were probably rather unrelated to what I was trying to do, I cited them but did not check their proof.

On balance, I think that making every author read every paper they ever cite would slow down the progress of science.

Caveat: this may be field-dependent. For instance, if the paper can be thought of as consisting of just one long definition, then yes, one should read the whole thing.