Why did God give man an imperfect law as stated in Hebrews, that is, the old law, when God is all perfect?
The Law given to Moses was a good law. "So then, the Law is holy, and the commandment is holy and righteous and good" (Romans 7:12). But there was a flaw in the Law: it depends on imperfect men to carry it out. "For if that first covenant had been faultless, there would have been no occasion sought for a second. For finding fault with them, ..." (Hebrews 8:7-8).
The Law of Moses also could not make flawed humans perfect before God. "For, on the one hand, there is a setting aside of a former commandment because of its weakness and uselessness (for the Law made nothing perfect)" (Hebrews 7:18-19). It could only look forward to a day when God would solve the problem of sin through the Messiah.
Now that Jesus came and died for mankind's sins, the weaker law was able to be replaced with a perfect law. "But one who looks intently at the perfect law, the law of liberty, and abides by it, not having become a forgetful hearer but an effectual doer, this man will be blessed in what he does" (James 1:25).
Thanks very much for your prompt response. My follow up question is whether God knew this flaw in the Law, and why he did give it to Moses knowing it had a flaw?
Often when a large task needs to be accomplished, we establish interim tasks that progress to the goal but are not adequate by themselves. For example, when a carpenter is raising a house, temporary boards are used to hold up walls, but those boards will be removed before the house is completed. God's goal was to save the world and that could only be done through His Son. However, the world needed to be prepared before Christ could accomplish the work of God. The Old Law, though it wasn't kept, did prepare people for the concept of righteousness and faith. It was a teacher. "Therefore the Law has become our tutor to lead us to Christ, so that we may be justified by faith" (Galatians 3:24). The Old Law also proved to mankind that they could not save themselves, even when told exactly what they needed to do. "But the Scripture has shut up everyone under sin, so that the promise by faith in Jesus Christ might be given to those who believe" (Galatians 3:22).
But now that the Law served its purpose, the scaffolding, which was the Law, has been removed. "But now that faith has come, we are no longer under a tutor" (Galatians 3:25).
Thank you. It is perfectly understood. I can now teach others about this topic.