Mat 17:14 And when they came to the crowd, a man came to Him, kneeling down to Him and saying,
Mat 17:15 Lord, have mercy on my son, for he is a lunatic and grievously vexed; for oftentimes he falls into the fire, and often into the water.
Mat 17:16 And I brought him to Your disciples, and they could not cure him.
Mat 17:17 Then Jesus answered and said, O faithless and perverse generation, how long shall I be with you? How long shall I suffer you? Bring him here to Me.
Mat 17:18 And Jesus rebuked the demon, and he departed out of him. And the child was cured from that very hour.
Mat 17:19 Then the disciples came to Jesus apart, and said, Why could we not cast him out?
Mat 17:20 And Jesus said to them, Because of your unbelief. For truly I say to you, If you have faith like a grain of mustard seed, you shall say to this mountain, Move from here to there. And it shall move. And nothing shall be impossible to you.
Mat 17:21 However, this kind does not go out except by prayer and fasting.
but by fasting and prayer: that is, in the exercise of a miraculous faith, expressed in solemn prayer to God, joined with fasting. It seems that Christ not only suggests, that faith was greatly wanting in his disciples; for which reason they could not cast out the devil, and heal the lunatic; but they had been wanting in prayer to God, to assist them in the exercise of their miraculous gifts; and that whilst Christ, and the other three disciples were on the mount, they had been feasting and indulging themselves with the people, and so were in a very undue disposition of mind, for such extraordinary service, for which our Lord tacitly rebukes them. This agrees with the notions of the Jews, who think that, by fasting, a divine soul (f) תשיג את מבוקשה, “may obtain that which is sought for”; and that among other things, for which a private person may afflict himself with fasting, this is one, מפני רוח רעה, “because of an evil spirit” (g); which they think may be got rid of this way.
John Gill’s Entire Exposition of the Bible