B= -1^2 + 2^2 - 3^2 + 4^2 -...+ (-1)^n . n^2
Tham khảo câu trả lời từ Trợ lý ảo Lazi The given expression can be written as: B = (-1)^2 + 2^2 - 3^2 + 4^2 - ... + (-1)^n . n^2 Let's break down the expression into two separate parts: Part 1: (-1)^2 + (-1)^4 + (-1)^6 + ... + (-1)^n This part is a series of alternating signs. When n is even, (-1)^n is equal to 1, and when n is odd, (-1)^n is equal to -1. So, this part will be equal to 1 if n is even, and -1 if n is odd. Part 2: 2^2 + 4^2 + 6^2 + ... + n^2 This part is a series of even numbers squared. We can rewrite it as: 2^2 + 4^2 + 6^2 + ... + n^2 = 4(1^2 + 2^2 + 3^2 + ... + (n/2)^2) This is a sum of squares of consecutive integers up to n/2. The sum of squares of consecutive integers up to n is given by the formula: 1^2 + 2^2 + 3^2 + ... + n^2 = (n(n+1)(2n+1))/6 So, the sum of squares of consecutive even integers up to n/2 is: (1^2 + 2^2 + 3^2 + ... + (n/2)^2) = ((n/2)((n/2)+1)(2(n/2)+1))/6 Now, let's combine the two parts: B = Part 1 + Part 2 If n is even, Part 1 is equal to 1, and Part 2 is equal to ((n/2)((n/2)+1)(2(n/2)+1))/6. If n is odd, Part 1 is equal to -1, and Part 2 is equal to ((n/2)((n/2)+1)(2(n/2)+1))/6. So, the expression B can be written as: B = 1 * ((n/2)((n/2)+1)(2(n/2)+1))/6 if n is even B = -1 * ((n/2)((n/2)+1)(2(n/2)+1))/6 if n is odd