Answer:
1. Let's assume the number of sides of the polygon Q is n.
2. According to the problem, the number of sides of polygon P is twice the number of sides of Q, so the number of sides of P is 2n.
3. The exterior angle of a regular polygon can be calculated using the formula 360/n, where n is the number of sides.
4. So, the exterior angle of polygon Q is 360/n, and the exterior angle of polygon P is 360/(2n).
5. The problem states that the difference between the exterior angle of Q and P is 45 degrees. Therefore, we can write the equation: 360/n - 360/(2n) = 45.
6. To solve the equation, we can simplify it by finding the least common multiple (LCM) of the denominators, which is 2n.
7. Multiplying each term of the equation by 2n, we get: 2n * (360/n) - 2n * (360/(2n)) = 45 * 2n.
8. Simplifying further, we have: 720 - 360 = 90n.
9. Combining like terms, we get: 360 = 90n.
10. Dividing both sides of the equation by 90, we find: n = 4.
11. Since the number of sides of polygon P is twice the number of sides of Q, we can conclude that P has 2 * 4 = 8 sides.
Therefore, the number of sides of polygon P is 8.