There is a simple explanation to your question.
Matthew 17 (New International Version)
1 After six days Jesus took with him Peter, James and John the brother of James, and led them up a high mountain by themselves. OK, six days after what?
Matthew 16:21-28 (New International Version)
Jesus Predicts His Death
21 From that time on Jesus began to explain to his disciples that he must go to Jerusalem and suffer many things at the hands of the elders, chief priests and teachers of the law, and that he must be killed and on the third day be raised to life.
22 Peter took him aside and began to rebuke him. "Never, Lord!" he said. "This shall never happen to you!"
23 Jesus turned and said to Peter, "Get behind me, Satan! You are a stumbling block to me; you do not have in mind the things of God, but the things of men."
24 Then Jesus said to his disciples, "If anyone would come after me, he must deny himself and take up his cross and follow me. 25 For whoever wants to save his life will lose it, but whoever loses his life for me will find it. 26 What good will it be for a man if he gains the whole world, yet forfeits his soul? Or what can a man give in exchange for his soul? 27 For the Son of Man is going to come in his Father's glory with his angels, and then he will reward each person according to what he has done. 28 I tell you the truth, some who are standing here will not taste death before they see the Son of Man coming in his kingdom."
Now, let us see the other account.
Luke 9:28-36 (New International Version)
28 About eight days after Jesus said this, he took Peter, John and James with him and went up onto a mountain to pray. OK, "about eight days after" what?
Luke 8:40-56 (New International Version)
A Dead Girl and a Sick Woman
40 Now when Jesus returned, a crowd welcomed him, for they were all expecting him. 41 Then a man named Jairus, a ruler of the synagogue, came and fell at Jesus' feet, pleading with him to come to his house 42 because his only daughter, a girl of about twelve, was dying.
As Jesus was on his way, the crowds almost crushed him. 43 And a woman was there who had been subject to bleeding for twelve years, but no one could heal her. 44 She came up behind him and touched the edge of his cloak, and immediately her bleeding stopped.
45 "Who touched me?" Jesus asked.
When they all denied it, Peter said, "Master, the people are crowding and pressing against you."
46 But Jesus said, "Someone touched me; I know that power has gone out from me."
47 Then the woman, seeing that she could not go unnoticed, came trembling and fell at his feet. In the presence of all the people, she told why she had touched him and how she had been instantly healed. 48 Then he said to her, "Daughter, your faith has healed you. Go in peace."
49 While Jesus was still speaking, someone came from the house of Jairus, the synagogue ruler. "Your daughter is dead," he said. "Don't bother the teacher any more."
50 Hearing this, Jesus said to Jairus, "Don't be afraid; just believe, and she will be healed."
51 When he arrived at the house of Jairus, he did not let anyone go in with him except Peter, John and James, and the child's father and mother. 52 Meanwhile, all the people were wailing and mourning for her. "Stop wailing," Jesus said. "She is not dead but asleep."
53 They laughed at him, knowing that she was dead. 54 But he took her by the hand and said, "My child, get up!" 55 Her spirit returned, and at once she stood up. Then Jesus told them to give her something to eat. 56 Her parents were astonished, but he ordered them not to tell anyone what had happened.
As it is plain to see, "about eight days" after a completely different event!
As it is written
Matthew 22:29 (New International Version)
29 Jesus replied, "You are in error because you do not know the Scriptures or the power of God.
The Holy Spirit is the power of God Zechariah 4:6 It is unlikely that He brought to your attention the difference in the chronology of these accounts.
There are many of these "discrepancies" in the four different gospel accounts but most of them are actually amount to nothing at all like this one or are easily explained when one looks carefully at the text or the writing style of the author.
All the best,