Jesus was speaking on hypocrisy regarding giving, praying, and now fasting. He set the tone by saying “Beware of practicing your righteousness before other people in order to be seen by them, for then you will have no reward from your Father who is in heaven” (Matthew 6:1).
The principle is the same with all three. You don’t prove your piety in public; you prove it by keeping your piety private. Your personal, private piety will lead to an open witness. Authenticity is anointed by God in the prayer closet, but aborted by men in the public square.
Of course, this does not mean that we are to live out our faith in private only. Indeed, we are not to hide our light (Matthew 5:14-16 / 1 John 3:18). The point is that our light is supposed to point to the One who is the Light. You aren’t supposed to avoid practicing the right things in public; you are supposed to avoid practicing the right things in public just to be seen by the right people. All Christians are called to demonstrate a love for God by acting on the principles He has taught, both publicly and privately.
The question is which principle are you operating under? The principle of hypocrisy is a demonstration of devotion in order for the person to be known to people. The principle of humility is a demonstration of devotion in order for Jesus to be known to people. Remember this. If you perform religious acts to impress other people, then you’ll miss God’s reward. Why did you do it, for people to see you work, or to see God work?
Pretense may make you popular with people, but hypocritical fasting just turns God’s stomach.