“For by works of the law no human being will be justified in his sight, since through the law comes knowledge of sin.” (Romans 3:20)
If God’s law is impossible to keep, then why did God give it? The Mosaic covenant was ratified thousands of years after Adam plunged mankind into sin, which means the Law was given to sinners who could not obey it perfectly. What is its purpose, if not that we would keep it perfectly? There are at least four distinct purposes of the law for Christians today, and each follows from the last (e.g. the second point is a natural result of the first point).
First, the law reveals God’s holiness. “I am the Lord who brought you up out of the land of Egypt to be your God. You shall therefore be holy, for I am holy” (Leviticus 11:39). Whether we are considering sweeping principles or specific commands, the law reveals the holiness of God. God delivered Israel in order that He would be their God. They were rescued from slavery to enter a close fellowship bond with the Lord. This fellowship required that Israel conform themselves to God’s character, or else the friction would provoke His righteous indignation. So by the design of fellowship, the law reveals God’s holiness.
Second, the law reveals our sinfulness. The man who gazes upon the potent holiness of God will soon become keenly aware of his own unholiness. This was Isaiah’s dilemma: “Woe is me! For I am lost… for my eyes have seen the King, the Lord of hosts!” (Isaiah 6:5). This sentiment is reflected in the New Testament: “For by works of the law no human being will be justified in his sight, since through the law comes knowledge of sin” (Romans 3:20). Perfect obedience to the law is pleasing in God’s sight, but who has perfect obedience to the law? No one. Therefore, when a man reads the law, he encounters a multitude of requirements which he has already failed to meet. In regards to his justification, no man can stand upon the law.
Third, the law leads us to Christ. In revealing our sinfulness, the law also leads us to the Gospel. By teaching us that we can’t save ourselves, the law teaches us to grasp for salvation elsewhere, in an alien righteousness. “So then, the law was our guardian until Christ came, in order that we might be justified by faith” (Galatians 3:24). The law does not reveal the Gospel (Ephesians 3:1-5), but it acts as a tutor to prepare us for it. No man can honestly square himself before the law and not be compelled to cry unto Jesus for mercy. The problem is that unbelieving hearts are not honest with themselves or God. It takes an act of the Holy Spirit to bring sinners into the revealing light of the law, to be healed by the radiant glory of Christ (John 3).
Fourth, the law teaches us righteousness. The law can only show us our sinfulness if it shows us what we should be doing. If the law does not teach us basic righteousness – that is, what a life of holiness to God looks like – then how can it condemn us and lead us to Christ? Further, if the law is a revelation of God’s holiness, then how is it not a standard of holiness today? All three previous points hinge upon this fourth point, that the law remains a binding revelation of righteousness for mankind today. This does not mean we should read Exodus-Deuteronomy and obey its prescriptions without exception. God Himself has declared several portions of His law non-binding upon us today. For example, it would be sinful to offer sacrifices of bulls and goats today, since Christ is the once for all sacrifice for our sins (Hebrews 10:1-18). We want to obey God’s Word, but we want to obey all of God’s Word, not just Exodus-Deuteronomy. This requires us to acknowledge that some Old Testament commands are lifted in the New Testament. So today, we confess the general equity of the law.
That the law teaches us righteousness should be even clearer when the substance of the New Covenant is brought into focus. The promise was always this: “For this is the covenant that I will make with the house of Israel after those days, declares the Lord: I will put my law within them, and I will write it on their hearts. And I will be their God, and they shall be my people” (Jeremiah 31:33, emphasis mine). The Gospel does not free us from obedience (Romans 6:1-2), it frees us for obedience. “For we are his workmanship, created in Christ Jesus for good works, which God prepared beforehand, that we should walk in them” (Ephesians 2:10). In fact, the master from which we are saved is disobedience: “For one who has died has been set free from sin” (Romans 6:7). Therefore, let us renew ourselves unto obedience, by the power of the God unto salvation (Philippians 2:12-13).
Question: Since no one can keep the law, what is its purpose?
Answer: That we may know the holy nature of God, and the sinful nature of our hearts; and thus our need of a Savior.
 Isaiah also illustrates this point. When he had cursed himself for his own unholiness (Isaiah 6:5), God cleansed Isaiah of sin (v.6).