3
$\begingroup$

Suppose I have the recurrence:

$$A(x) = 2A(x/2) + x^2$$ with $A(1) = 1$.

Is it possible to derive a function using Generating Functions? I know in Generatingfunctionology they shows show to solve for recurrences like $A(x) = 2A(x-1) + x$. But is it possible to solve for the above recurrence as well?

  • 3
    Can you change variables, $x=2^y$ so $x/2=2^{y-1}$, then use the method you mention?2011-11-25
  • 0
    @GEdgar: So you are assuming that y is an integer? I know how to solve this using that assumption, but I want to know if I can use generating functions.2011-11-25
  • 0
    No. He doesn't.2011-11-25
  • 0
    Mark: As written, the recurrence makes sense only for $x$ a power of two (and GEdgar's comment makes sense for such an $x$). For a general $x$, one needs to tweak the equation using floors and ceilings appropriately.2011-11-25
  • 0
    @Srivatsan: why does it make sense only for x to a power of two?2011-11-25
  • 2
    Let's take $x = 72$, something not a power of $2$. $A(72)$ is defined in terms of $A(36)$. $A(36)$ in terms of $A(18)$, which is based on $A(9)$. What next? [Unless $x$ is a power of $2$, repeated halving will always end up in an odd number bigger than $1$ for which the recurrence is not defined.]2011-11-25

2 Answers 2

4

I am a little confused by the way you worded this question (it seems that you have a functional equation rather than a recurrence relation), so I interpreted it in the only way that I could make sense of it. If this is not what you are looking for, then please clarify in your original question or in a comment.

Let's assume that $A(x)$ is a formal power (or possibly Laurent) series, $A(x) = \sum_n a_n x^n$. Plugging this into your equation, we get $$ \sum_n a_n x^n = 2 \sum_n a_n \frac{x^n}{2^n} + x^2 $$ For $n\neq 2$, we get $a_n = 2^{1-n} a_n$, so if $n \neq 1,2$ we get $a_n = 0$. For $n=2$, we get $a_2 = a_2/2 + 1$, so $a_2 = 2$. Finally, the condition $A(1) = 1$ gives $a_1 = -1$, so we have $$ A(x) = -x + 2x^2 $$

Check: $$ 2 A(x/2) + x^2 = 2( -x/2 + x^2/2) + x^2 = -x + 2x^2 = A(x) $$

  • 0
    $A(x)$ is a sequence, not a generating function. The recurrence should perhaps be written $a_n = 2 a_{\lfloor n/2 \rfloor} + n^2$.2011-11-25
0

As per Qiaochu's comment on the answer so far, consider

$$a_n = 2 a_{\lfloor n/2 \rfloor} + n^2$$

with $a_1 = 1$ and $a_n = 1, 6, 11, 28, 37, 58, 71, 120,\dots$ for $n = 1,2,\dots$. Then

$$a_{2n} = 2 a_n + 4n^2 \quad\quad\text{and}\quad\quad a_{2n+1} = 2 a_n + 4n^2 + 4n + 1$$

where both recurrences are valid for $n\ge 1$. Working with each recurrence we can use generating functions to obtain a system of functional equations. Let

$$f(z) = \sum_{n=1}^{\infty}a_n z^n$$

be the generating function for the sequence of $a_n$'s. Working with the first equation we multiply by $z^{2n}$, sum over all $n\ge 1$

$$\sum_{n=1}^{\infty}a_{2n}z^{2n} = 2\sum_{n=1}^{\infty}a_n(z^2)^n + \sum_{n=1}^{\infty}4n^2z^{2n}$$

and obtain

$$ \frac{f(z) + f(-z)}{2} = 2f(z^2) + \frac{4 z^2 \left(1+z^2\right)}{\left(1-z^2\right)^3}$$

Working with the second equation, we multiply by $z^{2n+1}$, sum over all $n\ge 1$

$$\sum_{n=1}^{\infty}a_{2n+1}z^{2n+1} = 2z\sum_{n=1}^{\infty}a_n(z^2)^n + \sum_{n=1}^{\infty}(4n^2+4n+1)z^{2n+1}$$

and obtain

$$\frac{f(z)-f(-z)}{2} -z = 2zf(z^2)+\frac{z^3 \left(z^4-2 z^2+9\right)}{\left(1-z^2\right)^3}$$

We can obtain a solution by solving these functional equations.

EDIT: Adding the two equations together and simplifying we obtain

$$f(z) = \frac{z+z^2}{(1-z)^3} + 2(1+z)f(z^2)$$

We can iterate this equation to obtain better and better approximation of $f(z)$. I believe that if we iterate enough times to have $f(z^{2^t})$ as part of the approximation, then the approximation will be exact for the first $2^t-1$ coefficients.