The adage is an adaptation from six verses from King Solomon's book of Proverbs:
He that spareth his rod hateth his son: but he that loveth him chasteneth him betimes. (Proverbs 13:24)
Chasten thy son while there is hope, and let not thy soul spare for his crying. (Proverbs 19:18)
Both of these verses appear in the Contrast of Goodness and Evil. From the Warnings and Instructions come the following four verses:
Foolishness is bound in the heart of a child; but the rod of correction shall drive it far from him. (Proverbs 22:15)
Withhold not correction from the child: for if thou beatest him with the rod, he shall not die. (Proverbs 23:13)
15 The rod and reproof give wisdom: but a child left to himself bringeth his mother to shame. 17 Correct thy son, and he shall give thee rest; yea, he shall give delight unto thy soul. (Proverbs 29:15, 17)
You will not find in the Bible the exact words of the "proverb" you hear today. Instead, you will hear King Solomon's contrast of good and evil and his warnings and instructions. Consider the message of the verses.
In 13.24 you find that if you do not discipline your child, you hate him. If you love him, you discipline him when necessary. *Note that the word for "rod" here is the same word as "frond", meaning then a palm branch, not the iron rod with which the kings ordered prisoners flogged.
In 19.18 you find that you should chastise your child early while he is still impressionable (good). (Evil) You should not fail (spare) to chastise your child because he cries or is remorseful.
In 22.15 you find that a child is not born with a moral compass or the knowledge to know his actions are folly. Discipline will teach him.
In 23.13 you find that if you discipline your