46. In the city, there are $n$ traffic lights. Each can be in one of three states (red, yellow, or green). In how many ways can all the traffic lights be lit?
46. If there is only one traffic light, there are 3 ways to turn it on. Now let's add a second traffic light. From any way of turning on one traffic light, by changing the state of the second, we can get three ways to turn on two. Thus, the number of ways will triple. In total: $3 \cdot 3=3^{2}$ ways. Now let's add a third traffic light. From any way of turning on two traffic lights, we can again get three ways to turn on three traffic lights by changing the state of the third. Again, the number of ways will triple. For three traffic lights, there will be $3 \cdot 3^{2}=3^{3}$ ways. When adding one traffic light, the number of ways always triples. Therefore, $n$ traffic lights can be turned on in $3^{n}$ ways.