Deuteronomy 21:14-23

14 But if you have no delight in her, you are to let her go wherever she will; you may not take a price for her as if she was your property, for you have made use of her for your pleasure.
15 If a man has two wives, one greatly loved and the other hated, and the two of them have had children by him; and if the first son is the child of the hated wife:
16 Then when he gives his property to his sons for their heritage, he is not to put the son of his loved one in the place of the first son, the son of the hated wife:
17 But he is to give his first son his birthright, and twice as great a part of his property: for he is the first-fruits of his strength and the right of the first son is his.
18 If a man has a son who is hard-hearted and uncontrolled, who gives no attention to the voice of his father and mother, and will not be ruled by them, though they give him punishment:
19 Then let his father and mother take him to the responsible men of the town, to the public place;
20 And say to them, This son of ours is hard-hearted and uncontrolled, he will not give attention to us; he gives himself up to pleasure and strong drink.
21 Then he is to be stoned to death by all the men of the town: so you are to put away the evil from among you; and all Israel, hearing of it, will be full of fear.
22 If a man does a crime for which the punishment is death, and he is put to death by hanging him on a tree;
23 Do not let his body be on the tree all night, but put it to rest in the earth the same day; for the man who undergoes hanging is cursed by God; so do not make unclean the land which the Lord your God is giving you for your heritage.