Creating Words of Length K from {1,...,k}: A Recursive Approach

  • Context: Undergrad 
  • Thread starter Thread starter MathematicalPhysicist
  • Start date Start date
Click For Summary

Discussion Overview

The discussion revolves around the problem of counting the number of words of length k that can be formed from the set {1,...,k} such that the digit '1' appears an even number of times. Participants explore recursive approaches and generating functions to derive a solution.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant proposes a recursive formula for counting valid words, suggesting that if no '1' appears, the count is (k-1)^k, and if '1' appears an even number of times, it leads to a relation a_k = (k-1)*a_k-1 + (k-1)^k.
  • Another participant corrects an earlier claim about the number of valid words for k=2, stating there are two valid options: '22' and '11'.
  • A participant challenges the initial recursive approach, arguing that the reasoning for appending a non-1 to a string with an even number of 1s is flawed and points out potential overcounting issues.
  • One participant suggests using power series (generating functions) as a solution method, indicating it is a powerful tool for such problems.
  • A later reply emphasizes the need to count strings with both even and odd numbers of '1's to derive a recurrence relation, hinting at a possible simplification.
  • Another participant expresses familiarity with generating functions but struggles to understand a specific equation presented in the context of the problem, seeking clarification on its derivation.

Areas of Agreement / Disagreement

Participants express differing views on the correctness of the proposed recursive formula and the counting methods. There is no consensus on the best approach to solve the problem, with multiple competing ideas and methods being discussed.

Contextual Notes

Some participants note limitations in their understanding of generating functions and the specific application to this problem, indicating unresolved steps in deriving the proposed equations.

MathematicalPhysicist
Science Advisor
Gold Member
Messages
4,662
Reaction score
372
how many words of length k can you create from {1,...,k} such that 1 appears even number of times?
well, for k=0 we have 1, for k=1 we have zero, and for k=2 we have one.
i thought to use here a recursion formula.
but not quite sure how to do so, i mean if k>=3, and a_k stands for the number of legitiamte words, then if no 1 appears in the word then we have (k-1)^k words, let's assume that in a_k-1 1 appears even number times then for the the last number we have (k-1) choices, so i think that the equation should be:
a_k=(k-1)*a_k-1+(k-1)^k
am i correct here?
now if this is correct then how find a suitable private answer for non homogenoues part?
 
Physics news on Phys.org
my mistake for a_2 we have two options 22 and 11.
 
You have written that the way to make a word of length k with an even number of 1s in it is to append a non-1 to a string of length k-1 with an even number of 1s. This is not true. Plus, you have over counted - why treat the string with no 1s in it separately and therefore counted it twice?
 
so how would you go to solve this?
i saw a solution with power series, but didn't understand it.
 
You should try to learn how to use power series (generating functions) - they are incredibly powerful.

If you really want a recurrence relation, then do the naive thing.

A string of length k is gotten by adding a digit to a string of length k-1. In order for this string of length k to have an even number of 1s, then the shorter string must have an even number of 1s and you append a non-1, or it has an odd number of 1s and you append a 1. So count them. Hint: do you need to count the number of strings with an odd number of 1s in or is there a way to write that in terms of strings with an even number of 1s?
 
yes i know how to use power series, my problem is that i don't undersatnd the answer.
I'm given that for
[tex]F(x)=\sum_{n>=0} a_n*x^n=(1+x^2/2!+x^4/4!+...)(1+x+x^2/2!+...)^{(k-1)}[/tex] where a_n is the sequence we searching for.
but i don't understand how did they got to this, can you explain?


p.s
iv'e learned already generating functions, but still i don't see how arrive to this equation.
 
Last edited:

Similar threads

  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 29 ·
Replies
29
Views
6K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 20 ·
Replies
20
Views
2K
  • · Replies 42 ·
2
Replies
42
Views
4K
  • · Replies 36 ·
2
Replies
36
Views
5K
Replies
10
Views
1K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K